add support for loading FP constants +0.0 and +1.0 to the dag isel,
authorDuraid Madina <duraid@octopus.com.au>
Wed, 2 Nov 2005 02:35:04 +0000 (02:35 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Wed, 2 Nov 2005 02:35:04 +0000 (02:35 +0000)
stop pretending -0.0 and -1.0 are machine constants

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

lib/Target/IA64/IA64ISelDAGToDAG.cpp
lib/Target/IA64/IA64ISelLowering.cpp

index 1a83d89743cab55856b3b9862e75e8dfbf9a5633..d3487f27862b04a30a237b2deab1f74100597295 100644 (file)
@@ -321,6 +321,14 @@ SDOperand IA64DAGToDAGISel::Select(SDOperand Op) {
 /* todo:
  * case ISD::DYNAMIC_STACKALLOC:
 */
+  case ISD::ConstantFP: {
+    if (cast<ConstantFPSDNode>(N)->isExactlyValue(+0.0))
+      return CurDAG->getRegister(IA64::F0, MVT::f64); // load 0.0
+    else if (cast<ConstantFPSDNode>(N)->isExactlyValue(+1.0))
+      return CurDAG->getRegister(IA64::F1, MVT::f64); // load 1.0
+    else
+      assert(0 && "Unexpected FP constant!");
+  }
 
   case ISD::FrameIndex: { // TODO: reduce creepyness
     int FI = cast<FrameIndexSDNode>(N)->getIndex();
index 2ffa24e78c0b42e4fbfc7347b3843037134cf20c..37f15eeb62c82b762e5797b9d52d35068a5cd896 100644 (file)
@@ -80,9 +80,6 @@ IA64TargetLowering::IA64TargetLowering(TargetMachine &TM)
 
       addLegalFPImmediate(+0.0);
       addLegalFPImmediate(+1.0);
-      addLegalFPImmediate(-0.0);
-      addLegalFPImmediate(-1.0);
-    
 }
 
 /// isFloatingPointZero - Return true if this is 0.0 or -0.0.