[llvm-commits] [llvm] r62571 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Bill Wendling isanbard at gmail.com
Mon Jan 19 22:10:43 PST 2009


Author: void
Date: Tue Jan 20 00:10:42 2009
New Revision: 62571

URL: http://llvm.org/viewvc/llvm-project?rev=62571&view=rev
Log:
Shift types need to match.

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

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Jan 20 00:10:42 2009
@@ -2958,11 +2958,12 @@
 ///
 /// where Op is the hexidecimal representation of floating point value.
 static SDValue
-GetExponent(SelectionDAG &DAG, SDValue Op) {
+GetExponent(SelectionDAG &DAG, SDValue Op, const TargetLowering &TLI) {
     SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, Op,
-                             DAG.getConstant(23, MVT::i32));
+                             DAG.getConstant(23, TLI.getShiftAmountTy()));
     SDValue t2 = DAG.getNode(ISD::SUB, MVT::i32, t1,
                              DAG.getConstant(127, MVT::i32));
+    //    SDValue t3 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t2);
     return DAG.getNode(ISD::UINT_TO_FP, MVT::f32, t2);
 }
 
@@ -3029,7 +3030,7 @@
 
     //   IntegerPartOfX <<= 23;
     IntegerPartOfX = DAG.getNode(ISD::SHL, MVT::i32, IntegerPartOfX,
-                                 DAG.getConstant(23, MVT::i32));
+                                 DAG.getConstant(23, TLI.getShiftAmountTy()));
 
     if (LimitFloatPrecision <= 6) {
       // For floating-point precision of 6:
@@ -3140,7 +3141,7 @@
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op);
 
     // Scale the exponent by log(2) [0.69314718f].
-    SDValue Exp = GetExponent(DAG, Op1);
+    SDValue Exp = GetExponent(DAG, Op1, TLI);
     SDValue LogOfExponent = DAG.getNode(ISD::FMUL, MVT::f32, Exp,
                                         getF32Constant(DAG, 0x3f317218));
 
@@ -3246,7 +3247,7 @@
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op);
 
     // Get the exponent.
-    SDValue LogOfExponent = GetExponent(DAG, Op1);
+    SDValue LogOfExponent = GetExponent(DAG, Op1, TLI);
 
     // Get the significand and build it into a floating-point number with
     // exponent of 1.
@@ -3351,7 +3352,7 @@
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op);
 
     // Scale the exponent by log10(2) [0.30102999f].
-    SDValue Exp = GetExponent(DAG, Op1);
+    SDValue Exp = GetExponent(DAG, Op1, TLI);
     SDValue LogOfExponent = DAG.getNode(ISD::FMUL, MVT::f32, Exp,
                                         getF32Constant(DAG, 0x3e9a209a));
 
@@ -3455,7 +3456,7 @@
 
     //   IntegerPartOfX <<= 23;
     IntegerPartOfX = DAG.getNode(ISD::SHL, MVT::i32, IntegerPartOfX,
-                                 DAG.getConstant(23, MVT::i32));
+                                 DAG.getConstant(23, TLI.getShiftAmountTy()));
 
     if (LimitFloatPrecision <= 6) {
       // For floating-point precision of 6:
@@ -3584,7 +3585,7 @@
 
     //   IntegerPartOfX <<= 23;
     IntegerPartOfX = DAG.getNode(ISD::SHL, MVT::i32, IntegerPartOfX,
-                                 DAG.getConstant(23, MVT::i32));
+                                 DAG.getConstant(23, TLI.getShiftAmountTy()));
 
     if (LimitFloatPrecision <= 6) {
       // For floating-point precision of 6:





More information about the llvm-commits mailing list