alexcrichton opened PR #6976 from alexcrichton:x64-bmi2
to bytecodealliance:main
:
This PR adds support for some isntructions in the BMI2 instruction set, namely
sarx
,shlx
,shrx
, androrx
. The shifting instructions can't encode immediates but use a 3-operand form and place no constraints on the amount being shifted by (as opposed tosar
-style instructions which require that in%cl
). Thex
-suffixed instructions are prioritized for this reason when BMI2 is enabled so long as an immediate shift amount isn't used. These new instrutions additionally support loading the value-to-shift from memory, unlike the old instructions (they store the result to memory as opposed to the new instructions which store the result in a register), but this functionality is not exposed at this time.For
rorx
the benefits are similar, but the amount being shifted by is required to be an immediate. This means that rotation instructions, either left or right, will unconditionally userorx
so long as the amount-to-rotate is an immediate. This theoretically reduces register allocator pressure since the destination register can be different from the source.I'll note that I don't personally have a compelling performance reason for adding these. I was poking around at instruction set extensions awhile back and never got around to making a PR for this until just now.
alexcrichton requested elliottt for a review on PR #6976.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #6976.
alexcrichton updated PR #6976.
alexcrichton updated PR #6976.
elliottt submitted PR review:
This looks good to me!
alexcrichton merged PR #6976.
Last updated: Dec 23 2024 at 13:07 UTC