Closed Bug 1656229 Opened 5 years ago Closed 5 years ago

SIMD code cleanup

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

x86_64
All
enhancement

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

A number of minor things in the SIMD code could stand to be cleaned up, for general hygiene. I have a separate list, but examples are: using the proper scratch register scopes; removing or commenting out dead code; using idiomatic code where we can (eg some code inspired by the V8 implementation synthesizes constants in a way we don't normally do that).

Always use ScratchSimd128Scope to claim ScratchSimd128Reg.

The only hard part is that the register was claimed deep in the
assembler in what appears to be a late non-AVX bugfix to work around
the fact that compare operations are not three-address on non-AVX.

I fixed this by making compare operations two-address and moving the
code that shuffles registers for this case into the macroassembler,
where the scratch can be claimed correctly.

As a result, we have less support for AVX, but since AVX is not
supported or tested this does not actually matter. A MOZ_CRASH
ensures we'll run into this if testing with AVX.

Another couple of similar cases elsewhere have similar local fixes:
MOZ_CRASH for AVX, two-address code for the normal case.

This is technical debt from the initial SIMD work - it's faster to load a
constant here than to compute it. Benchmark data not forthcoming, but
elsewhere i've found that we break even at two instructions and it's
better to load the value than to compute it in three.

Depends on D87284

I'm open to discussing this one, but I thought it would be good to separate unused SIMD
code (from asm.js) from code that's being actively maintained. Hence the new file, and
a separate section in the header for the declarations.

Depends on D87306

Blocks: wasm-simd
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a475ddc1aeec Use scratch scopes for v128. r=jseward https://hg.mozilla.org/integration/autoland/rev/3da7d219a9e4 replace a computation by a constant load. r=jseward https://hg.mozilla.org/integration/autoland/rev/da2ca8466508 move unused SIMD code. r=jseward
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: