[llvm-commits] [llvm] r117427 - in /llvm/trunk: lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/X86/x86-32.s

Kevin Enderby enderby at apple.com
Tue Oct 26 17:59:28 PDT 2010


Author: enderby
Date: Tue Oct 26 19:59:28 2010
New Revision: 117427

URL: http://llvm.org/viewvc/llvm-project?rev=117427&view=rev
Log:
Added some aliases to the fcomip and fucompi Intel instructions. So that llvm-mc
will accept versions that the darwin assembler allows.  Forms ending in "pi" and
forms without all the operands.

Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/X86/x86-32.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=117427&r1=117426&r2=117427&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Oct 26 19:59:28 2010
@@ -703,6 +703,8 @@
     .Case("fwait", "wait")
     .Case("movzx", "movzb")  // FIXME: Not correct.
     .Case("fildq", "fildll")
+    .Case("fcompi", "fcomip")
+    .Case("fucompi", "fucomip")
     .Default(Name);
 
   // FIXME: Hack to recognize cmp<comparison code>{ss,sd,ps,pd}.
@@ -991,9 +993,20 @@
                                              NameLoc, NameLoc));
   }
 
+  // The assembler accepts this instruction with no operand as a synonym for an
+  // instruction taking %st(1),%st(0). e.g. "fcompi" -> "fcompi %st(1),st(0)".
+  if (Name == "fcompi" && Operands.size() == 1) {
+    Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
+                                             NameLoc, NameLoc));
+    Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(0)"),
+                                             NameLoc, NameLoc));
+  }
+
   // The assembler accepts these instructions with two few operands as a synonym
   // for taking %st(1),%st(0) or X, %st(0).
-  if ((Name == "fcomi" || Name == "fucomi") && Operands.size() < 3) {
+  if ((Name == "fcomi" || Name == "fucomi" || Name == "fucompi" ||
+       Name == "fcompi" ) &&
+      Operands.size() < 3) {
     if (Operands.size() == 1)
       Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
                                                NameLoc, NameLoc));

Modified: llvm/trunk/test/MC/X86/x86-32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-32.s?rev=117427&r1=117426&r2=117427&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86-32.s (original)
+++ llvm/trunk/test/MC/X86/x86-32.s Tue Oct 26 19:59:28 2010
@@ -702,3 +702,27 @@
 // CHECK: sidt	4(%eax)
 // CHECK:  encoding: [0x0f,0x01,0x48,0x04]
         	sidtl	4(%eax)
+
+// CHECK: fcomip	%st(2), %st(0)
+// CHECK:  encoding: [0xdf,0xf2]
+        	fcompi	%st(2),%st
+
+// CHECK: fcomip	%st(2), %st(0)
+// CHECK:  encoding: [0xdf,0xf2]
+        	fcompi	%st(2)
+
+// CHECK: fcomip	%st(1), %st(0)
+// CHECK:  encoding: [0xdf,0xf1]
+        	fcompi
+
+// CHECK: fucomip	%st(2), %st(0)
+// CHECK:  encoding: [0xdf,0xea]
+        	fucompi	%st(2),%st
+
+// CHECK: fucomip	%st(2), %st(0)
+// CHECK:  encoding: [0xdf,0xea]
+        	fucompi	%st(2)
+
+// CHECK: fucomip	%st(1), %st(0)
+// CHECK:  encoding: [0xdf,0xe9]
+        	fucompi





More information about the llvm-commits mailing list