diff options
| author | Bill Wendling <isanbard@gmail.com> | 2009-01-20 21:17:57 +0000 | 
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2009-01-20 21:17:57 +0000 | 
| commit | 2395916c871b30389b1b85d53cafa10d24194640 (patch) | |
| tree | 927a645b8ea5577066a15e9f336f078cbd7d8026 /llvm/lib/CodeGen | |
| parent | c9268d8effffd9b17ba5c1f9cc4c2c1f7d2afb38 (diff) | |
| download | bcm5719-llvm-2395916c871b30389b1b85d53cafa10d24194640.tar.gz bcm5719-llvm-2395916c871b30389b1b85d53cafa10d24194640.zip | |
Use "SINT_TO_FP" instead of "UINT_TO_FP" when getting the exponent. This was
causing the limited precision stuff to produce the wrong result for values in
the range [0, 1).
llvm-svn: 62615
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 25 | 
1 files changed, 13 insertions, 12 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index ea2156b2e4f..b134b23489e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -2945,26 +2945,27 @@ void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI,  /// where Op is the hexidecimal representation of floating point value.  static SDValue  GetSignificand(SelectionDAG &DAG, SDValue Op) { -    SDValue t1 = DAG.getNode(ISD::AND, MVT::i32, Op, -                             DAG.getConstant(0x007fffff, MVT::i32)); -    SDValue t2 = DAG.getNode(ISD::OR, MVT::i32, t1, -                             DAG.getConstant(0x3f800000, MVT::i32)); -    return DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t2); +  SDValue t1 = DAG.getNode(ISD::AND, MVT::i32, Op, +                           DAG.getConstant(0x007fffff, MVT::i32)); +  SDValue t2 = DAG.getNode(ISD::OR, MVT::i32, t1, +                           DAG.getConstant(0x3f800000, MVT::i32)); +  return DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t2);  }  /// GetExponent - Get the exponent:  /// -///   (float)((Op1 >> 23) - 127); +///   (float)(int)(((Op & 0x7f800000) >> 23) - 127);  ///  /// where Op is the hexidecimal representation of floating point value.  static SDValue  GetExponent(SelectionDAG &DAG, SDValue Op, const TargetLowering &TLI) { -    SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, Op, -                             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); +  SDValue t0 = DAG.getNode(ISD::AND, MVT::i32, Op, +                           DAG.getConstant(0x7f800000, MVT::i32)); +  SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, t0, +                           DAG.getConstant(23, TLI.getShiftAmountTy())); +  SDValue t2 = DAG.getNode(ISD::SUB, MVT::i32, t1, +                           DAG.getConstant(127, MVT::i32)); +  return DAG.getNode(ISD::SINT_TO_FP, MVT::f32, t2);  }  /// getF32Constant - Get 32-bit floating point constant. | 

