Fix CodeGen/Generic/fpowi-promote.ll and PR1239
[oota-llvm.git] / lib / CodeGen / SelectionDAG / LegalizeDAG.cpp
index 357e2cd9f15c6192217e21dcbecfbcee110247c3..84a381bf633256054231111650b37d4c1d13824c 100644 (file)
@@ -3328,6 +3328,18 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
                            DAG.getValueType(VT));
     break;
 
+  case ISD::FPOWI: {
+    // Promote f32 powi to f64 powi.  Note that this could insert a libcall
+    // directly as well, which may be better.
+    Tmp1 = PromoteOp(Node->getOperand(0));
+    assert(Tmp1.getValueType() == NVT);
+    Result = DAG.getNode(ISD::FPOWI, NVT, Tmp1, Node->getOperand(1));
+    if (NoExcessFPPrecision)
+      Result = DAG.getNode(ISD::FP_ROUND_INREG, NVT, Result,
+                           DAG.getValueType(VT));
+    break;
+  }
+    
   case ISD::AND:
   case ISD::OR:
   case ISD::XOR: