Implement the fpowi now by lowering to a libcall
authorChris Lattner <sabre@nondot.org>
Sat, 9 Sep 2006 06:03:30 +0000 (06:03 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Sep 2006 06:03:30 +0000 (06:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index c32da68454a63a91e46b6ec6e612651d5d57f857..3545b246894f5e9a9eecfb4a01b8836e140270c7 100644 (file)
@@ -2581,7 +2581,14 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       break;
     }
     break;
-    
+  case ISD::FPOWI: {
+    // We always lower FPOWI into a libcall.  No target support it yet.
+    const char *FnName = Node->getValueType(0) == MVT::f32
+                            ? "__powisf2" : "__powidf2";
+    SDOperand Dummy;
+    Result = ExpandLibCall(FnName, Node, Dummy);
+    break;
+  }
   case ISD::BIT_CONVERT:
     if (!isTypeLegal(Node->getOperand(0).getValueType())) {
       Result = ExpandBIT_CONVERT(Node->getValueType(0), Node->getOperand(0));
index 4fa168fccdeacad68435ed27f038ba4a18aa98cf..044a2fa976fbf6e52f39bbd643c142cc1db46388 100644 (file)
@@ -2404,6 +2404,7 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
   case ISD::FSQRT:  return "fsqrt";
   case ISD::FSIN:   return "fsin";
   case ISD::FCOS:   return "fcos";
+  case ISD::FPOWI:  return "fpowi";
 
   // Binary operators
   case ISD::ADD:    return "add";
index f1cdcdfa9796cb78d4ecad2e4e86d86c5d46e431..578f8d2f3da88982babddcead346142c604165f9 100644 (file)
@@ -1620,6 +1620,13 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
                              getValue(I.getOperand(1)).getValueType(),
                              getValue(I.getOperand(1))));
     return 0;
+  case Intrinsic::powi_f32:
+  case Intrinsic::powi_f64:
+    setValue(&I, DAG.getNode(ISD::FPOWI,
+                             getValue(I.getOperand(1)).getValueType(),
+                             getValue(I.getOperand(1)),
+                             getValue(I.getOperand(2))));
+    return 0;
   case Intrinsic::pcmarker: {
     SDOperand Tmp = getValue(I.getOperand(1));
     DAG.setRoot(DAG.getNode(ISD::PCMARKER, MVT::Other, getRoot(), Tmp));