Closed Bug 2077020 Opened 2 days ago Closed 2 minutes ago

[loong64] Implement constant RHS specialization for WASM SIMD comparisons

Categories

(Core :: JavaScript Engine: JIT, task)

task

Tracking

()

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: csmantle, Assigned: csmantle)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Loong64 LSX has immediate comparison instructions, for example VSEQI.[BHDW]. These instruction splats the sign- or zero-extended immediate to all lanes as RHS, then perform the comparison. These can elide one vector value materialization when applicable.

This includes the following instructions:

  • VSEQI.[BHWD]
  • VS{LE,LT}I.[BHWD]{,U}

These masm methods emits VS{EQ,LE,LT}I.* when possible, otherwise fall
back to the loadConstantSimd128() and reg-reg compare methods.

The effect of this stack is as follows. This WAT module:

(module
  (memory 1)
  (func (export "f")
    (v128.store (i32.const 32)
      (i32x4.lt_s (v128.load (i32.const 0)) (v128.const i32x4 5 5 5 5)))))

... compiles to the following native code before this stack:

[...]
vld          $vr0, $s7, 0
vldi         $vr1, 0x805
vslt.w       $vr0, $vr0, $vr1
vst          $vr0, $s7, 32
[...]

... while it compiles to this after the stack:

[...]
vld          $vr0, $s7, 0
vslti.w      $vr0, $vr0, 5
vst          $vr0, $s7, 32
[...]
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d0f18859d99e https://hg.mozilla.org/integration/autoland/rev/12ce49174bb2 Revert "Bug 2077020 - [loong64] Part 4: Enable const RHS specialization for applicable WASM SIMD compare ops. r=yury" for causing linting failures @IonTypes.h.

Backed out for causing linting failures @IonTypes.h.

Flags: needinfo?(webmaster)

This looks trivial to fix. The problem is that when I switched from std::optional to mozilla::Maybe, I didn't remove the header inclusion.

Flags: needinfo?(webmaster)
Pushed by webmaster@csmantle.top: https://github.com/mozilla-firefox/firefox/commit/5b33955c6780 https://hg.mozilla.org/integration/autoland/rev/82d7a581de8f Part 1: Introduce SimdConstant::splatIntValue() to extract splatted integer values. r=yury https://github.com/mozilla-firefox/firefox/commit/3a3255e6473d https://hg.mozilla.org/integration/autoland/rev/4c50de45ab36 [loong64] Part 2: Introduce LSX compare instructions with immediate RHS. r=yury https://github.com/mozilla-firefox/firefox/commit/44f70b6e77d3 https://hg.mozilla.org/integration/autoland/rev/4011fb8ab706 [loong64] Part 3: Implement compareInt{8x16,16x8,32x4,64x2} with SimdConstant rhs. r=yury https://github.com/mozilla-firefox/firefox/commit/5320dd8219ad https://hg.mozilla.org/integration/autoland/rev/14723ea5c6f2 [loong64] Part 4: Enable const RHS specialization for applicable WASM SIMD compare ops. r=yury
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/77bc6deb2fcc https://hg.mozilla.org/mozilla-central/rev/fade3dffbde4 Part 1: Introduce SimdConstant::splatIntValue() to extract splatted integer values. r=yury https://github.com/mozilla-firefox/firefox/commit/faa491daa654 https://hg.mozilla.org/mozilla-central/rev/50838e3ec5da [loong64] Part 2: Introduce LSX compare instructions with immediate RHS. r=yury https://github.com/mozilla-firefox/firefox/commit/e357ad5755e3 https://hg.mozilla.org/mozilla-central/rev/ac0abda237ac [loong64] Part 3: Implement compareInt{8x16,16x8,32x4,64x2} with SimdConstant rhs. r=yury
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: