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 | 7adc95f69e334815eddacc0662b6cce12a8a8cb6 (patch) | |
| tree | b8c5bd6a06f82978eb16717d376aa78fb56e8ba3 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
| parent | fb43639926bc2a52c4105f8ad6fac60ac1f1165b (diff) | |
| download | llvm-7adc95f69e334815eddacc0662b6cce12a8a8cb6.zip llvm-7adc95f69e334815eddacc0662b6cce12a8a8cb6.tar.gz llvm-7adc95f69e334815eddacc0662b6cce12a8a8cb6.tar.bz2 | |
Recommit 132404 with fixes. rdar://problem/5993888
llvm-svn: 132424
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index bb4df27..2eee501 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/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()); |
