You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) APX: movbe load from a stack local into r16-r31 is encoded as a store (opcode 0x61 instead of 0x60) #135389
apxRelated to the Intel Advanced Performance Extensions (APX)area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
With APX and MOVBE, BinaryPrimitives.ReverseEndianness of a stack local whose result goes to an extended GPR (r16-r31) is emitted with the EVEX MAP4 MOVBE store opcode. The disassembler prints a load, but on APX hardware the instruction overwrites the local with garbage and never loads the value.
Same bytes from crossgen2 and ILC. The address-mode path is correct: ReverseEndianness(a[14]) emits 62E47C08607B48 movbe r23d, dword ptr [rbx+0x48].
Regression?
No, present since APX support was added: reproduces on .NET 10.0, 11.0-rc2 and main. .NET 8.0/9.0 don't support apx.
Notes
genCodeForBswap picks INS_movbe_apx for an EGPR target with a contained memory operand.
emitOutputSV (emitxarch.cpp) unconditionally does code |= 0x01 for 2/4/8-byte operands, turning the RM opcode 0x60 into the MR opcode 0x61; emitOutputAM already exempts INS_movbe_apx.
Fix: apply the same exemption in emitOutputSV (and check emitOutputCV, which has the same pattern).
Hi @EgorBo, just to confirm: since this instance was intentionally compiled with APX enabled, this is only an encoding issue and not related to any LSRA misbehavior, correct?
8. Looking into it, thanks for the notice.
Hi @EgorBo, just to confirm: since this instance was intentionally compiled with APX enabled, this is only an encoding issue and not related to any LSRA misbehavior, correct?
#135451
Submitted a fix for the encoding issue. Tested on APX capable hardware, the newly added regression test was failing on main, and now passes with the fix in place. I don't see any evidence suggesting this is an LSRA issue. From the emitter side, however, it appears the wrong opcode was selected.
apxRelated to the Intel Advanced Performance Extensions (APX)area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Activity
dotnet-policy-service commentedon Oct 8, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JulieLeeMSFT commentedon Oct 8, 2026
@Ruihan-Yin, PTAL.
Ruihan-Yin commentedon Oct 8, 2026
Looking into it, thanks for the notice.
Hi @EgorBo, just to confirm: since this instance was intentionally compiled with APX enabled, this is only an encoding issue and not related to any LSRA misbehavior, correct?
EgorBo commentedon Oct 8, 2026
not related to any LSRA misbehavior, correct?
Hard to say, I don't have any APX hw to confirm
Ruihan-Yin commentedon Oct 9, 2026
#135451
Submitted a fix for the encoding issue. Tested on APX capable hardware, the newly added regression test was failing on main, and now passes with the fix in place. I don't see any evidence suggesting this is an LSRA issue. From the emitter side, however, it appears the wrong opcode was selected.