Introduce a new FP instruction type to separate the compare cases from the
twoarg cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14143 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/FloatingPoint.cpp b/lib/Target/X86/FloatingPoint.cpp
index 0a8f4ac..ceb3bf6 100644
--- a/lib/Target/X86/FloatingPoint.cpp
+++ b/lib/Target/X86/FloatingPoint.cpp
@@ -215,12 +215,8 @@
     case X86II::ZeroArgFP:  handleZeroArgFP(I); break;
     case X86II::OneArgFP:   handleOneArgFP(I);  break;  // fstp ST(0)
     case X86II::OneArgFPRW: handleOneArgFPRW(I); break; // ST(0) = fsqrt(ST(0))
-    case X86II::TwoArgFP:
-      if (I->getOpcode() != X86::FpUCOM && I->getOpcode() != X86::FpUCOMI)
-        handleTwoArgFP(I);
-      else
-        handleCompareFP(I);
-      break;
+    case X86II::TwoArgFP:   handleTwoArgFP(I); break;
+    case X86II::CompareFP:  handleCompareFP(I); break;
     case X86II::CondMovFP:  handleCondMovFP(I); break;
     case X86II::SpecialFP:  handleSpecialFP(I); break;
     default: assert(0 && "Unknown FP Type!");
diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp
index 0a8f4ac..ceb3bf6 100644
--- a/lib/Target/X86/X86FloatingPoint.cpp
+++ b/lib/Target/X86/X86FloatingPoint.cpp
@@ -215,12 +215,8 @@
     case X86II::ZeroArgFP:  handleZeroArgFP(I); break;
     case X86II::OneArgFP:   handleOneArgFP(I);  break;  // fstp ST(0)
     case X86II::OneArgFPRW: handleOneArgFPRW(I); break; // ST(0) = fsqrt(ST(0))
-    case X86II::TwoArgFP:
-      if (I->getOpcode() != X86::FpUCOM && I->getOpcode() != X86::FpUCOMI)
-        handleTwoArgFP(I);
-      else
-        handleCompareFP(I);
-      break;
+    case X86II::TwoArgFP:   handleTwoArgFP(I); break;
+    case X86II::CompareFP:  handleCompareFP(I); break;
     case X86II::CondMovFP:  handleCondMovFP(I); break;
     case X86II::SpecialFP:  handleSpecialFP(I); break;
     default: assert(0 && "Unknown FP Type!");
diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h
index cc44d26..5b3ddd0 100644
--- a/lib/Target/X86/X86InstrInfo.h
+++ b/lib/Target/X86/X86InstrInfo.h
@@ -155,11 +155,15 @@
     // argument.  For example: fadd, fsub, fmul, etc...
     TwoArgFP   = 4 << FPTypeShift,
 
+    // CompareFP - 2 arg FP instructions which implicitly read ST(0) and an
+    // explicit argument, but have no destination.  Example: fucom, fucomi, ...
+    CompareFP  = 5 << FPTypeShift,
+
     // CondMovFP - "2 operand" floating point conditional move instructions.
-    CondMovFP  = 5 << FPTypeShift,
+    CondMovFP  = 6 << FPTypeShift,
 
     // SpecialFP - Special instruction forms.  Dispatch by opcode explicitly.
-    SpecialFP  = 6 << FPTypeShift,
+    SpecialFP  = 7 << FPTypeShift,
 
     // PrintImplUsesAfter - Print out implicit uses in the assembly output after
     // the normal operands.
diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td
index e8888d6..7de7cb8 100644
--- a/lib/Target/X86/X86InstrInfo.td
+++ b/lib/Target/X86/X86InstrInfo.td
@@ -66,8 +66,9 @@
 def OneArgFP   : FPFormat<2>;
 def OneArgFPRW : FPFormat<3>;
 def TwoArgFP   : FPFormat<4>;
-def CondMovFP  : FPFormat<5>;
-def SpecialFP  : FPFormat<6>;
+def CompareFP  : FPFormat<5>;
+def CondMovFP  : FPFormat<6>;
+def SpecialFP  : FPFormat<7>;
 
 
 class X86Inst<string nam, bits<8> opcod, Format f, MemType m, ImmType i> : Instruction {
@@ -736,8 +737,8 @@
 def FpMUL : FPI<"FMUL", 0, Pseudo, TwoArgFP>;    // f1 = fmul f2, f3
 def FpDIV : FPI<"FDIV", 0, Pseudo, TwoArgFP>;    // f1 = fdiv f2, f3
 
-def FpUCOM  : FPI<"FUCOM", 0, Pseudo, TwoArgFP>;  // FPSW = fucom f1, f2
-def FpUCOMI : FPI<"FUCOMI", 0, Pseudo, TwoArgFP>;  // CC = fucomi f1, f2
+def FpUCOM  : FPI<"FUCOM", 0, Pseudo, CompareFP>;   // FPSW = fucom f1, f2
+def FpUCOMI : FPI<"FUCOMI", 0, Pseudo, CompareFP>;  // CC = fucomi f1, f2
 def FpGETRESULT : FPI<"FGETRESULT",0, Pseudo, SpecialFP>;  // FPR = ST(0)
 def FpSETRESULT : FPI<"FSETRESULT",0, Pseudo, SpecialFP>;  // ST(0) = FPR