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
v was byte-zero-extend loaded from stack argument MOVBLZX v+0(FP), AX
v was shifted right by 4 SHRB $4, AL
and then
compiler makes sure that higher bytes of AX are zero MOVBLZX AL, AX
Step 3 is not neccessary since original MOVBLZX v+0(FP), AX is zero-extend move and after it AX[31:8] is zero and logical right shifts preserve that property (even more: for unsigned v, i if we know at some time that v is <= A, for v>>i we can know that it is <= A/2^i).
What did you expect to see?
No high-bytes rezeroing after right shift on zero-extended byte-loaded register.
Please answer these questions before submitting your issue. Thanks!
What did you do?
Hello up there. Please consider the following function:
(https://play.golang.org/p/6t7Bq7lw2k)
it compiles to the following assembly:
where:
v
was byte-zero-extend loaded from stack argumentMOVBLZX v+0(FP), AX
v
was shifted right by 4SHRB $4, AL
and then
MOVBLZX AL, AX
Step 3 is not neccessary since original
MOVBLZX v+0(FP), AX
is zero-extend move and after it AX[31:8] is zero and logical right shifts preserve that property (even more: for unsigned v, i if we know at some time that v is <= A, for v>>i we can know that it is <= A/2^i).What did you expect to see?
No high-bytes rezeroing after right shift on zero-extended byte-loaded register.
What did you see instead?
Unneccessary high-bytes rezeroing instruction emitted.
Does this issue reproduce with the latest release (go1.8)?
Yes.
Possibly related issues
#18575
System details
Thanks beforehand,
Kirill
/cc @randall77
The text was updated successfully, but these errors were encountered: