-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/asm: accepts MOVB (BX)(R8*4), AH incorrectly #14288
Comments
We'll catch this as part of the big asm fixup. |
But expanding what I said yesterday just a bit: never use MOVB or MOVW with a register destination, since it's inefficient (it's a read-modify-write on the target register). Instead use MOVL for reg->reg and use MOVBLZX or MOVWLZX for mem->reg; those are pure writes on the target register. |
Actually, on third glance I'm even more surprised you are trying to address AH (not AL). Why? |
SSA never uses AH. I just ran into this while writing a test case. |
MOVB (BX)(R8*4), AH
The assembler accepts this instruction but silently misassembles it to:
MOVB (BX)(R8*4), SP
This is because we need the RAX prefix for the indexed address, but then the RAX prefix also forces the use of standard register naming instead of the weird *H register naming.
gas rejects this instruction
movb (%rbx,%r8,4),%ah
withcan't encode register '%ah' in an instruction requiring REX prefix.
@rsc
The text was updated successfully, but these errors were encountered: