[llvm-commits] [llvm] r126244 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/X86/x86-64.s
Joerg Sonnenberger
joerg at bec.de
Tue Feb 22 12:40:09 PST 2011
Author: joerg
Date: Tue Feb 22 14:40:09 2011
New Revision: 126244
URL: http://llvm.org/viewvc/llvm-project?rev=126244&view=rev
Log:
Use the same (%dx) hack for in[bwl] as for out[bwl].
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/x86-64.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=126244&r1=126243&r2=126244&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Feb 22 14:40:09 2011
@@ -775,6 +775,19 @@
delete &Op;
}
}
+ // Same hack for "in[bwl]? (%dx), %al" -> "inb %dx, %al".
+ if ((Name == "inb" || Name == "inw" || Name == "inl" || Name == "in") &&
+ Operands.size() == 3) {
+ X86Operand &Op = *(X86Operand*)Operands.begin()[1];
+ if (Op.isMem() && Op.Mem.SegReg == 0 &&
+ isa<MCConstantExpr>(Op.Mem.Disp) &&
+ cast<MCConstantExpr>(Op.Mem.Disp)->getValue() == 0 &&
+ Op.Mem.BaseReg == MatchRegisterName("dx") && Op.Mem.IndexReg == 0) {
+ SMLoc Loc = Op.getEndLoc();
+ Operands.begin()[1] = X86Operand::CreateReg(Op.Mem.BaseReg, Loc, Loc);
+ delete &Op;
+ }
+ }
// FIXME: Hack to handle recognize s{hr,ar,hl} $1, <op>. Canonicalize to
// "shift <op>".
Modified: llvm/trunk/test/MC/X86/x86-64.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=126244&r1=126243&r2=126244&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86-64.s (original)
+++ llvm/trunk/test/MC/X86/x86-64.s Tue Feb 22 14:40:09 2011
@@ -241,13 +241,32 @@
// PR8114
// CHECK: outb %al, %dx
+// CHECK: outb %al, %dx
+// CHECK: outw %ax, %dx
// CHECK: outw %ax, %dx
// CHECK: outl %eax, %dx
+// CHECK: outl %eax, %dx
-out %al, (%dx)
-out %ax, (%dx)
-outl %eax, (%dx)
-
+out %al, (%dx)
+outb %al, (%dx)
+out %ax, (%dx)
+outw %ax, (%dx)
+out %eax, (%dx)
+outl %eax, (%dx)
+
+// CHECK: inb %dx, %al
+// CHECK: inb %dx, %al
+// CHECK: inw %dx, %ax
+// CHECK: inw %dx, %ax
+// CHECK: inl %dx, %eax
+// CHECK: inl %dx, %eax
+
+in (%dx), %al
+inb (%dx), %al
+in (%dx), %ax
+inw (%dx), %ax
+in (%dx), %eax
+inl (%dx), %eax
// rdar://8431422
More information about the llvm-commits
mailing list