Closed Bug 1641641 Opened 5 years ago Closed 5 years ago

Lower SIMD compares so as to respect predicates available in hardware

Categories

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

x86_64
All
enhancement

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

For float compares (compareFloat32x4 and compareFloat32x4 masm abstractions) the architecture has =, <, <=, and != but not > or >=. Currently we swap operands in masm to synthesize the missing operators, and that looks clean, but in vcmpps() in Assembler-x86-shared.h there are additional hacks to move operands around and use temp regs for this if some conditions hold (and I expect they commonly do), it's all pretty ugly. By swapping operations during lowering (at the latest), we can perhaps avoid this.

For int compares, we have = and > and we can synthesize the others by swapping operands and/or negating the result. Swapping the operands in masm is not always clean and lowering should do a better job setting things up for good code generation.

Closely related to bug 1640662.

Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Summary: Lower SIMD float compares so as to respect predicates available in hardware → Lower SIMD compares so as to respect predicates available in hardware

Swap operands and/or change the operation of SIMD compares during
lowering to generate better code. Introduce test cases for the
generated code.

The tests are a little brittle, but how else would we test this? And
if the register allocator can't be counted on not to insert spurious
moves when presented with an optimal scenario, what can it be counted
on to do?

Drive-by fixes: Clean up some comments, and remove a small masm
abstraction that did not pay for itself.

Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/92fe89072e8c Lower SIMD compares to avoid operations not present in hardware. r=jseward
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d4e300134105 Lower SIMD compares to avoid operations not present in hardware. r=jseward
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: