[PATCH] D120592: [X86] Preserve redundant Address-Size override prefix

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 23:04:20 PST 2022


skan added a comment.

In D120592#3353538 <https://reviews.llvm.org/D120592#3353538>, @Amir wrote:

> @skan 
> I moved NeedAddressOverride check out of X86MCCodeEmitter.cpp (along with isXXBitMemOperand) into X86MCTargetDesc in order to use it in printInstFlags to test if addr32 is a redundant prefix.

I belive it's the correct direction. However there is still a bug. (see my inline comments)



================
Comment at: llvm/test/MC/Disassembler/X86/prefixes.txt:54
 
-# CHECK: rep stosq %rax, %es:(%edi)
+# CHECK: rep addr32 stosq %rax, %es:(%edi)
 0xf3 0x67 0x48 0xab
----------------
0x67 is not redundant here. It changes `(%rdi)` to `(%edi)`. You can not encode
`rep addr32 stosq %rax, %es:(%edi)` w/  `llvm-mc --show-encoding`


================
Comment at: llvm/test/MC/X86/addr16-32.s:20-23
+# CHECK-NEXT: 67 6d                         addr32 insl   %dx, %es:(%edi)
+# CHECK-NEXT: 67 65 6f                      addr32 outsl  %gs:(%esi), %dx
+# CHECK-NEXT: 67 6d                         addr32 insl   %dx, %es:(%edi)
+# CHECK-NEXT: 67 65 6f                      addr32 outsl  %gs:(%esi), %dx
----------------
0x67 is not redundant here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120592/new/

https://reviews.llvm.org/D120592



More information about the llvm-commits mailing list