[llvm-commits] [llvm] r56032 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Evan Cheng evan.cheng at apple.com
Tue Sep 9 16:35:54 PDT 2008


Author: evancheng
Date: Tue Sep  9 18:35:53 2008
New Revision: 56032

URL: http://llvm.org/viewvc/llvm-project?rev=56032&view=rev
Log:
A few more places where FPOW is being ignored.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56032&r1=56031&r2=56032&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep  9 18:35:53 2008
@@ -3531,6 +3531,9 @@
         Result = DAG.getNode(ISD::SELECT, VT, Tmp2, Tmp1, Tmp3);
         break;
       }
+      case ISD::FSQRT:
+      case ISD::FSIN:
+      case ISD::FCOS: 
       case ISD::FLOG:
       case ISD::FLOG2:
       case ISD::FLOG10:
@@ -3540,10 +3543,7 @@
       case ISD::FFLOOR:
       case ISD::FCEIL:
       case ISD::FRINT:
-      case ISD::FNEARBYINT:
-      case ISD::FSQRT:
-      case ISD::FSIN:
-      case ISD::FCOS: {
+      case ISD::FNEARBYINT: {
         MVT VT = Node->getValueType(0);
 
         // Expand unsupported unary vector operators by unrolling them.
@@ -3606,6 +3606,7 @@
           LC = GetFPLibCall(VT, RTLIB::NEARBYINT_F32, RTLIB::NEARBYINT_F64,
                             RTLIB::NEARBYINT_F80, RTLIB::NEARBYINT_PPCF128);
           break;
+      break;
         default: assert(0 && "Unreachable!");
         }
         SDValue Dummy;
@@ -4214,12 +4215,16 @@
                            DAG.getValueType(VT));
     break;
 
+  case ISD::FPOW:
   case ISD::FPOWI: {
-    // Promote f32 powi to f64 powi.  Note that this could insert a libcall
+    // Promote f32 pow(i) to f64 pow(i).  Note that this could insert a libcall
     // directly as well, which may be better.
     Tmp1 = PromoteOp(Node->getOperand(0));
+    Tmp2 = Node->getOperand(1);
+    if (Node->getOpcode() == ISD::FPOW)
+      Tmp2 = PromoteOp(Tmp2);
     assert(Tmp1.getValueType() == NVT);
-    Result = DAG.getNode(ISD::FPOWI, NVT, Tmp1, Node->getOperand(1));
+    Result = DAG.getNode(Node->getOpcode(), NVT, Tmp1, Tmp2);
     if (NoExcessFPPrecision)
       Result = DAG.getNode(ISD::FP_ROUND_INREG, NVT, Result,
                            DAG.getValueType(VT));
@@ -6615,7 +6620,8 @@
   case ISD::FCEIL:
   case ISD::FRINT:
   case ISD::FNEARBYINT:
-  case ISD::FPOW: {
+  case ISD::FPOW:
+  case ISD::FPOWI: {
     RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
     switch(Node->getOpcode()) {
     case ISD::FSQRT:





More information about the llvm-commits mailing list