Closed Bug 1693482 Opened 4 years ago Closed 3 years ago

SIMD optimization x64/x86: inline constant load in various instructions

Categories

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

x86_64
All
enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: lth, Assigned: yury)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

Looking through the code for instances of loadConstantSimd128() into a temp followed by a single use of that temp, I see several cases where it might be profitable to load the constant as part of the instruction:

For PSHUFB in MacroAssembler::permuteInt8x16
For CMPGTB in MacroAssembler::swizzleInt8x16 (see also bug 1690483)
For PXOR and bitwiseXorSimd128 (!) in MacroAssemblerX86Shared::compareInt8x16, MacroAssemblerX86Shared::compareInt16x8, MacroAssemblerX86Shared::compareInt32x4
For UNPCKLPS and SUBPD in MacroAssemblerX86Shared::unsignedConvertInt32x4ToFloat64x2
For ANDPD in MacroAssemblerX86Shared::truncSatFloat64x2ToInt32x4
For MINPD and ADDPD in MacroAssemblerX86Shared::unsignedTruncSatFloat64x2ToInt32x4

In some cases, the profitability is questionable: if the constant is 0 or ~0 then it may be faster to generate it into a temp and use the temp. But the determination about profitability should be made in the emitter itself, as indeed binarySimd128() does properly already on behalf of eg bitwiseXorSimd128() and the others. The callers just have to make sure not to use the ScratchSimd128 temp, and we can enforce this safely.

Mostly this just finishes work already started.

Bug 1691485 adds pairwise add ops (i16x8.extadd_pairwise_XXXX) that require usage of loadConstantSimd128

Bug 1691489 adds popcnt op. X86 uses loadConstantSimd128 in MacroAssemblerX86Shared::popcntInt8x16

Assignee: nobody → yk
Status: NEW → ASSIGNED
Attachment #9209823 - Attachment is obsolete: true
Keywords: leave-open
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/092ee6b0c9f2 SIMD optimization x64/x86: inline constant load for PSHUFB in MacroAssembler::permuteInt8x16. r=lth
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/34e647c79d32 SIMD optimization x64/x86: inline constant load for CMPGTB in MacroAssembler::swizzleInt8x16. r=lth

The leave-open keyword is there and there is no activity for 6 months.
:lth, maybe it's time to close this bug?

Flags: needinfo?(lhansen)

Initial work was performed by a volunteer but there are more work items here. Unassigning.

Assignee: yk → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(lhansen)

The leave-open keyword is there and there is no activity for 6 months.
:lth, maybe it's time to close this bug?
For more information, please visit auto_nag documentation.

Flags: needinfo?(lhansen)

Still more work to do.

Flags: needinfo?(lhansen)
Assignee: nobody → ydelendik
Attachment #9272752 - Attachment description: WIP: Bug 1693482 - [x64/x86] inline constant load in various instructions → Bug 1693482 - [x64/x86] inline constant load in various instructions. r?lth
Status: NEW → ASSIGNED
Pushed by ydelendik@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2ed4b7048825 [x64/x86] inline constant load in various instructions. r=lth

all done, closing

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: