Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
[oota-llvm.git] / lib / Target / X86 / X86InstrFPStack.td
index 832ea6177c1851eda455e0824a0371caca9e8888..2ae904f324396da89b4b489fbfef792b91f744a7 100644 (file)
 // FPStack specific DAG Nodes.
 //===----------------------------------------------------------------------===//
 
-def SDTX86FpGet     : SDTypeProfile<1, 0, [SDTCisFP<0>]>;
 def SDTX86FpGet2    : SDTypeProfile<2, 0, [SDTCisVT<0, f80>, 
                                            SDTCisVT<1, f80>]>;
-def SDTX86FpSet     : SDTypeProfile<0, 1, [SDTCisFP<0>]>;
 def SDTX86Fld       : SDTypeProfile<1, 2, [SDTCisFP<0>,
                                            SDTCisPtrTy<1>, 
                                            SDTCisVT<2, OtherVT>]>;
@@ -33,10 +31,6 @@ def SDTX86FpToIMem  : SDTypeProfile<0, 2, [SDTCisFP<0>, SDTCisPtrTy<1>]>;
 
 def SDTX86CwdStore  : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
 
-def X86fpget_st0    : SDNode<"X86ISD::FP_GET_ST0", SDTX86FpGet,
-                             [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
-def X86fpset        : SDNode<"X86ISD::FP_SET_RESULT", SDTX86FpSet,
-                             [SDNPHasChain, SDNPOutFlag]>;
 def X86fld          : SDNode<"X86ISD::FLD", SDTX86Fld,
                              [SDNPHasChain, SDNPMayLoad]>;
 def X86fst          : SDNode<"X86ISD::FST", SDTX86Fst,
@@ -78,45 +72,45 @@ def fpimmneg1 : PatLeaf<(fpimm), [{
 let usesCustomDAGSchedInserter = 1 in {  // Expanded by the scheduler.
   def FP32_TO_INT16_IN_MEM : I<0, Pseudo,
                               (outs), (ins i16mem:$dst, RFP32:$src),
-                              "#FP32_TO_INT16_IN_MEM PSEUDO!",
+                              "##FP32_TO_INT16_IN_MEM PSEUDO!",
                               [(X86fp_to_i16mem RFP32:$src, addr:$dst)]>;
   def FP32_TO_INT32_IN_MEM : I<0, Pseudo,
                               (outs), (ins i32mem:$dst, RFP32:$src),
-                              "#FP32_TO_INT32_IN_MEM PSEUDO!",
+                              "##FP32_TO_INT32_IN_MEM PSEUDO!",
                               [(X86fp_to_i32mem RFP32:$src, addr:$dst)]>;
   def FP32_TO_INT64_IN_MEM : I<0, Pseudo,
                               (outs), (ins i64mem:$dst, RFP32:$src),
-                              "#FP32_TO_INT64_IN_MEM PSEUDO!",
+                              "##FP32_TO_INT64_IN_MEM PSEUDO!",
                               [(X86fp_to_i64mem RFP32:$src, addr:$dst)]>;
   def FP64_TO_INT16_IN_MEM : I<0, Pseudo,
                               (outs), (ins i16mem:$dst, RFP64:$src),
-                              "#FP64_TO_INT16_IN_MEM PSEUDO!",
+                              "##FP64_TO_INT16_IN_MEM PSEUDO!",
                               [(X86fp_to_i16mem RFP64:$src, addr:$dst)]>;
   def FP64_TO_INT32_IN_MEM : I<0, Pseudo,
                               (outs), (ins i32mem:$dst, RFP64:$src),
-                              "#FP64_TO_INT32_IN_MEM PSEUDO!",
+                              "##FP64_TO_INT32_IN_MEM PSEUDO!",
                               [(X86fp_to_i32mem RFP64:$src, addr:$dst)]>;
   def FP64_TO_INT64_IN_MEM : I<0, Pseudo,
                               (outs), (ins i64mem:$dst, RFP64:$src),
-                              "#FP64_TO_INT64_IN_MEM PSEUDO!",
+                              "##FP64_TO_INT64_IN_MEM PSEUDO!",
                               [(X86fp_to_i64mem RFP64:$src, addr:$dst)]>;
   def FP80_TO_INT16_IN_MEM : I<0, Pseudo,
                               (outs), (ins i16mem:$dst, RFP80:$src),
-                              "#FP80_TO_INT16_IN_MEM PSEUDO!",
+                              "##FP80_TO_INT16_IN_MEM PSEUDO!",
                               [(X86fp_to_i16mem RFP80:$src, addr:$dst)]>;
   def FP80_TO_INT32_IN_MEM : I<0, Pseudo,
                               (outs), (ins i32mem:$dst, RFP80:$src),
-                              "#FP80_TO_INT32_IN_MEM PSEUDO!",
+                              "##FP80_TO_INT32_IN_MEM PSEUDO!",
                               [(X86fp_to_i32mem RFP80:$src, addr:$dst)]>;
   def FP80_TO_INT64_IN_MEM : I<0, Pseudo,
                               (outs), (ins i64mem:$dst, RFP80:$src),
-                              "#FP80_TO_INT64_IN_MEM PSEUDO!",
+                              "##FP80_TO_INT64_IN_MEM PSEUDO!",
                               [(X86fp_to_i64mem RFP80:$src, addr:$dst)]>;
 }
 
 let isTerminator = 1 in
   let Defs = [FP0, FP1, FP2, FP3, FP4, FP5, FP6] in
-    def FP_REG_KILL  : I<0, Pseudo, (outs), (ins), "#FP_REG_KILL", []>;
+    def FP_REG_KILL  : I<0, Pseudo, (outs), (ins), "##FP_REG_KILL", []>;
 
 // All FP Stack operations are represented with four instructions here.  The
 // first three instructions, generated by the instruction selector, use "RFP32"
@@ -138,26 +132,23 @@ let isTerminator = 1 in
 // encoding and asm printing info).
 
 // Pseudo Instructions for FP stack return values.
-def FpGET_ST0_32 : FpI_<(outs RFP32:$dst), (ins), SpecialFP,
-                        [(set RFP32:$dst, X86fpget_st0)]>;       // FPR = ST(0)
-def FpGET_ST0_64 : FpI_<(outs RFP64:$dst), (ins), SpecialFP,
-                        [(set RFP64:$dst, X86fpget_st0)]>;       // FPR = ST(0)
-def FpGET_ST0_80 : FpI_<(outs RFP80:$dst), (ins), SpecialFP,
-                        [(set RFP80:$dst, X86fpget_st0)]>;       // FPR = ST(0)
-
-def FpGET_ST0_ST1 : FpI_<(outs RFP80:$dst1, RFP80:$dst2), (ins), SpecialFP,
-                         []>;                        // FPR = ST(0), FPR = ST(1)
-
+def FpGET_ST0_32 : FpI_<(outs RFP32:$dst), (ins), SpecialFP, []>; // FPR = ST(0)
+def FpGET_ST0_64 : FpI_<(outs RFP64:$dst), (ins), SpecialFP, []>; // FPR = ST(0)
+def FpGET_ST0_80 : FpI_<(outs RFP80:$dst), (ins), SpecialFP, []>; // FPR = ST(0)
+
+// FpGET_ST1* should only be issued *after* an FpGET_ST0* has been issued when
+// there are two values live out on the stack from a call or inlineasm.  This
+// magic is handled by the stackifier.  It is not valid to emit FpGET_ST1* and
+// then FpGET_ST0*.  In addition, it is invalid for any FP-using operations to
+// occur between them.
+def FpGET_ST1_32 : FpI_<(outs RFP32:$dst), (ins), SpecialFP, []>; // FPR = ST(1)
+def FpGET_ST1_64 : FpI_<(outs RFP64:$dst), (ins), SpecialFP, []>; // FPR = ST(1)
+def FpGET_ST1_80 : FpI_<(outs RFP80:$dst), (ins), SpecialFP, []>; // FPR = ST(1)
 
 let Defs = [ST0] in {
-def FpSETRESULT32 : FpI_<(outs), (ins RFP32:$src), SpecialFP,
-                      [(X86fpset RFP32:$src)]>;// ST(0) = FPR
-
-def FpSETRESULT64 : FpI_<(outs), (ins RFP64:$src), SpecialFP,
-                      [(X86fpset RFP64:$src)]>;// ST(0) = FPR
-
-def FpSETRESULT80 : FpI_<(outs), (ins RFP80:$src), SpecialFP,
-                      [(X86fpset RFP80:$src)]>;// ST(0) = FPR
+def FpSET_ST0_32 : FpI_<(outs), (ins RFP32:$src), SpecialFP, []>; // ST(0) = FPR
+def FpSET_ST0_64 : FpI_<(outs), (ins RFP64:$src), SpecialFP, []>; // ST(0) = FPR
+def FpSET_ST0_80 : FpI_<(outs), (ins RFP80:$src), SpecialFP, []>; // ST(0) = FPR
 }
 
 // FpIf32, FpIf64 - Floating Point Psuedo Instruction template.
@@ -351,7 +342,7 @@ def CMOVNP_F : FPI<0xD8, AddRegFrm, (outs RST:$op), (ins),
                   "fcmovnu\t{$op, %st(0)|%ST(0), $op}">, DB;
 
 // Floating point loads & stores.
-let isSimpleLoad = 1 in {
+let canFoldAsLoad = 1 in {
 def LD_Fp32m   : FpIf32<(outs RFP32:$dst), (ins f32mem:$src), ZeroArgFP,
                   [(set RFP32:$dst, (loadf32 addr:$src))]>;
 let isReMaterializable = 1, mayHaveSideEffects = 1 in