Separate FILD and FILD_FLAG, the later is only used for SSE2. It produces a
authorEvan Cheng <evan.cheng@apple.com>
Sat, 4 Feb 2006 02:20:30 +0000 (02:20 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 4 Feb 2006 02:20:30 +0000 (02:20 +0000)
flag so it can be flagged to a FST.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25953 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
lib/Target/X86/X86InstrInfo.td

index 1015f5e7af66b6ca6b00288ce367ace32d92a910..def4f5701704fc0acbb81271aa936acc3ce22a3a 100644 (file)
@@ -1476,18 +1476,19 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
     std::vector<MVT::ValueType> Tys;
     Tys.push_back(MVT::f64);
     Tys.push_back(MVT::Other);
-    Tys.push_back(MVT::Flag);
+    if (X86ScalarSSE) Tys.push_back(MVT::Flag);
     std::vector<SDOperand> Ops;
     Ops.push_back(Chain);
     Ops.push_back(StackSlot);
     Ops.push_back(DAG.getValueType(SrcVT));
-    Result = DAG.getNode(X86ISD::FILD, Tys, Ops);
+    Result = DAG.getNode(X86ScalarSSE ? X86ISD::FILD_FLAG :X86ISD::FILD,
+                         Tys, Ops);
 
     if (X86ScalarSSE) {
       Chain = Result.getValue(1);
       SDOperand InFlag = Result.getValue(2);
 
-      // FIXME: Currently the FST is flagged to the FILD. This
+      // FIXME: Currently the FST is flagged to the FILD_FLAG. This
       // shouldn't be necessary except that RFP cannot be live across
       // multiple blocks. When stackifier is fixed, they can be uncoupled.
       MachineFunction &MF = DAG.getMachineFunction();
@@ -1974,6 +1975,7 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const {
   case X86ISD::FAND:               return "X86ISD::FAND";
   case X86ISD::FXOR:               return "X86ISD::FXOR";
   case X86ISD::FILD:               return "X86ISD::FILD";
+  case X86ISD::FILD_FLAG:          return "X86ISD::FILD_FLAG";
   case X86ISD::FP_TO_INT16_IN_MEM: return "X86ISD::FP_TO_INT16_IN_MEM";
   case X86ISD::FP_TO_INT32_IN_MEM: return "X86ISD::FP_TO_INT32_IN_MEM";
   case X86ISD::FP_TO_INT64_IN_MEM: return "X86ISD::FP_TO_INT64_IN_MEM";
index bccd10b3d97506abf1621e5c2807acd1bd262178..88d8e6ca3fbc919e9811dd0400493aebd304edaf 100644 (file)
@@ -49,11 +49,13 @@ namespace llvm {
       /// to X86::XORPS or X86::XORPD.
       FXOR,
 
-      /// FILD - This instruction implements SINT_TO_FP with the integer source
-      /// in memory and FP reg result.  This corresponds to the X86::FILD*m
-      /// instructions. It has three inputs (token chain, address, and source
-      /// type) and three outputs (FP value, token chain, and a flag).
+      /// FILD, FILD_FLAG - This instruction implements SINT_TO_FP with the
+      /// integer source in memory and FP reg result.  This corresponds to the
+      /// X86::FILD*m instructions. It has three inputs (token chain, address,
+      /// and source type) and two outputs (FP value and token chain). FILD_FLAG
+      /// also produces a flag).
       FILD,
+      FILD_FLAG,
 
       /// FP_TO_INT*_IN_MEM - This instruction implements FP_TO_SINT with the
       /// integer destination in memory and a FP reg source.  This corresponds
index 7e228d302383830a4e21f372519ebd1b6c304fa4..3e8cc09f4bf1d2e51b9c6b3bc8e3d3f4041b9194 100644 (file)
@@ -108,6 +108,8 @@ def X86fld     : SDNode<"X86ISD::FLD",      SDTX86Fld,
 def X86fst     : SDNode<"X86ISD::FST",      SDTX86Fst,
                         [SDNPHasChain, SDNPInFlag]>;
 def X86fild    : SDNode<"X86ISD::FILD",     SDTX86Fild,
+                        [SDNPHasChain]>;
+def X86fildflag: SDNode<"X86ISD::FILD_FLAG",SDTX86Fild,
                         [SDNPHasChain, SDNPOutFlag]>;
 def X86fp_to_i16mem : SDNode<"X86ISD::FP_TO_INT16_IN_MEM", SDTX86FpToIMem,
                         [SDNPHasChain]>;
@@ -3121,7 +3123,8 @@ def : Pat<(f64 fp64immneg0), (FpCHS (FpLD0))>, Requires<[FPStack]>;
 def : Pat<(f64 fp64immneg1), (FpCHS (FpLD1))>, Requires<[FPStack]>;
 
 // Used to conv. i64 to f64 since there isn't a SSE version.
-def : Pat<(X86fild addr:$src, i64), (FpILD64m addr:$src)>, Requires<[HasSSE2]>;
+def : Pat<(X86fildflag addr:$src, i64), (FpILD64m addr:$src)>,
+      Requires<[HasSSE2]>;
 
 //===----------------------------------------------------------------------===//
 // Some peepholes