SIMD optimization: Unused shuffle operands still generate code
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: lth, Assigned: yury)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Sometimes an i8x16.shuffle can be lowered to a single instruction, for example, a shuffle with one of the operands being zero can sometimes be lowered to an instruction that ignores the zero. This is typical of operations that shift bytes left and right in the vector, shifting in zeroes - the zeroes are implicit in the instruction.
In this situation, our current code for rewriting shuffles still leaves the zero constant floating around in the LIR graph because it is being reached before the shuffle operation that doesn't need it. And code is then generated for that node. It's just a pxor r,r where the r is dead before and after so it's not the end of the world, but it's annoying and it creates extra register pressure right there. And because it's a SIMD value we don't necessarily want to flag it as emittedAtUses (though there's a discussion to be had about that).
(In general, I would expect the same problem to be the case for most of the lowerings that ignore one operand, though the bytecode most likely uses the same input for the two arguments and it won't matter.)
To do better, we probably have to lift the rewriting of shuffle out of the LIR level and into the MIR level; that way, the constant MIR node can be ignored earlier and will not generate LIR.
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Depends on D124245
Updated•3 years ago
|
Comment 4•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a88e03315396
https://hg.mozilla.org/mozilla-central/rev/682739fe4e83
Description
•