diff options
author | Stuart Hastings <stuart@apple.com> | 2011-06-01 21:33:14 +0000 |
---|---|---|
committer | Stuart Hastings <stuart@apple.com> | 2011-06-01 21:33:14 +0000 |
commit | ec880283b3682982c750c9b78f6a9b4777e21883 (patch) | |
tree | bd220a445b0e2ebc5c1cbf8a4295d894df6a205e /lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 9aaa02a1d26a0969e95b285ea1190920a5bb37db (diff) |
Recommit 132404 with fixes. rdar://problem/5993888
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index bb4df27034..2eee5012b1 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1759,13 +1759,14 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, if (NewMask == APInt::getSignBit(Op.getValueType().getSizeInBits()) && Op.getOperand(0).getValueType().isFloatingPoint() && !Op.getOperand(0).getValueType().isVector()) { - if (isOperationLegalOrCustom(ISD::FGETSIGN, MVT::i32)) { - EVT Ty = (isOperationLegalOrCustom(ISD::FGETSIGN, Op.getValueType())) ? - Op.getValueType() : MVT::i32; + bool OpVTLegal = isOperationLegalOrCustom(ISD::FGETSIGN, Op.getValueType()); + bool i32Legal = isOperationLegalOrCustom(ISD::FGETSIGN, MVT::i32); + if (OpVTLegal || i32Legal) { + EVT Ty = OpVTLegal ? Op.getValueType() : MVT::i32; // Make a FGETSIGN + SHL to move the sign bit into the appropriate // place. We expect the SHL to be eliminated by other optimizations. SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Op.getOperand(0)); - if (Ty != Op.getValueType()) + if (!OpVTLegal) Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, Op.getValueType(), Sign); unsigned ShVal = Op.getValueType().getSizeInBits()-1; SDValue ShAmt = TLO.DAG.getConstant(ShVal, Op.getValueType()); |