[llvm] r335379 - [X86][AsmParser] Allow (%bp, %si) and (%bp, %di) to be encoded without using a zero displacement.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 22 12:42:21 PDT 2018
Author: ctopper
Date: Fri Jun 22 12:42:21 2018
New Revision: 335379
URL: http://llvm.org/viewvc/llvm-project?rev=335379&view=rev
Log:
[X86][AsmParser] Allow (%bp,%si) and (%bp,%di) to be encoded without using a zero displacement.
(%bp) can't be encoded without a displacement. The encoding is instead used for displacement alone. So a 1 byte displacement of 0 must be used. But if there is an index register we can encode without a displacement.
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
llvm/trunk/test/MC/X86/address-size.s
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp?rev=335379&r1=335378&r2=335379&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp Fri Jun 22 12:42:21 2018
@@ -476,7 +476,7 @@ void X86MCCodeEmitter::emitMemModRMByte(
}
if (Disp.isImm() && isDisp8(Disp.getImm())) {
- if (Disp.getImm() == 0 && BaseRegNo != N86::EBP) {
+ if (Disp.getImm() == 0 && RMfield != 6) {
// There is no displacement; just the register.
EmitByte(ModRMByte(0, RegOpcodeField, RMfield), CurByte, OS);
return;
Modified: llvm/trunk/test/MC/X86/address-size.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/address-size.s?rev=335379&r1=335378&r2=335379&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/address-size.s (original)
+++ llvm/trunk/test/MC/X86/address-size.s Fri Jun 22 12:42:21 2018
@@ -25,3 +25,7 @@
// CHECK: encoding: [0x67,0xc6,0x06,0x00]
movb $0x5a, (%di,%bp,1)
// CHECK: encoding: [0xc6,0x03,0x5a]
+ movb $0x5a, (%bp,%di,1)
+// CHECK: encoding: [0xc6,0x03,0x5a]
+ movb $0x5a, (%bp,%si,1)
+// CHECK: encoding: [0xc6,0x02,0x5a]
More information about the llvm-commits
mailing list