add some aliases for f[u]comi, part of rdar://8431422
authorChris Lattner <sabre@nondot.org>
Wed, 15 Sep 2010 04:08:38 +0000 (04:08 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 15 Sep 2010 04:08:38 +0000 (04:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113930 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/X86/x86_instructions.s

index dde34631ef41ca445a76c90f8b9c812920f57b28..c21fc7ab56e173178b75461efb6dea719558ef23 100644 (file)
@@ -933,13 +933,15 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
                                              NameLoc, NameLoc));
   }
   
-  // The assembler accepts these instructions with no operand as a synonym for
-  // an instruction acting on st,st(1).  e.g. "faddp" -> "faddp %st(0),%st(1)".
-  //if (() &&
-  //    Operands.size() == 1) {
-  //  Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
-  //                                           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 (Operands.size() == 1)
+      Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(1)"),
+                                               NameLoc, NameLoc));
+    Operands.push_back(X86Operand::CreateReg(MatchRegisterName("st(0)"),
+                                             NameLoc, NameLoc));
+  }
   
   return false;
 }
index 4bdd171445deb40d81bcfe3a66a87704c96c7af5..cd7c6e117a785ea9952531d7c04501bafb42c36b 100644 (file)
@@ -235,3 +235,17 @@ fsubrp
 fmulp
 fdivp
 fdivrp
+
+// CHECK: fcomi        %st(1), %st(0)
+// CHECK: fcomi        %st(2), %st(0)
+// CHECK: fucomi       %st(1), %st(0)
+// CHECK: fucomi       %st(2), %st(0)
+// CHECK: fucomi       %st(2), %st(0)
+
+fcomi
+fcomi  %st(2)
+fucomi
+fucomi %st(2)
+fucomi %st(2), %st
+
+