mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-28 00:50:37 +00:00
Avoid FGETSIGN of 80-bit types. Fixes PR10085.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132681 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7c48913af6
commit
57f1fde7fc
@ -1760,18 +1760,20 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ISD::BITCAST:
|
case ISD::BITCAST:
|
||||||
// If this is an FP->Int bitcast and if the sign bit is the only thing that
|
// If this is an FP->Int bitcast and if the sign bit is the only
|
||||||
// is demanded, turn this into a FGETSIGN.
|
// thing demanded, turn this into a FGETSIGN.
|
||||||
if (NewMask == APInt::getSignBit(Op.getValueType().getSizeInBits()) &&
|
if (NewMask == APInt::getSignBit(Op.getValueType().getSizeInBits()) &&
|
||||||
Op.getOperand(0).getValueType().isFloatingPoint() &&
|
Op.getOperand(0).getValueType().isFloatingPoint() &&
|
||||||
!Op.getOperand(0).getValueType().isVector()) {
|
!Op.getOperand(0).getValueType().isVector()) {
|
||||||
if (isOperationLegalOrCustom(ISD::FGETSIGN, MVT::i32)) {
|
bool OpVTLegal = isOperationLegalOrCustom(ISD::FGETSIGN, Op.getValueType());
|
||||||
EVT Ty = (isOperationLegalOrCustom(ISD::FGETSIGN, Op.getValueType())) ?
|
bool i32Legal = isOperationLegalOrCustom(ISD::FGETSIGN, MVT::i32);
|
||||||
Op.getValueType() : MVT::i32;
|
if ((OpVTLegal || i32Legal) && Op.getValueType().isSimple()) {
|
||||||
|
EVT Ty = OpVTLegal ? Op.getValueType() : MVT::i32;
|
||||||
// Make a FGETSIGN + SHL to move the sign bit into the appropriate
|
// Make a FGETSIGN + SHL to move the sign bit into the appropriate
|
||||||
// place. We expect the SHL to be eliminated by other optimizations.
|
// place. We expect the SHL to be eliminated by other optimizations.
|
||||||
SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Op.getOperand(0));
|
SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Op.getOperand(0));
|
||||||
if (Ty != Op.getValueType())
|
unsigned OpVTSizeInBits = Op.getValueType().getSizeInBits();
|
||||||
|
if (!OpVTLegal && OpVTSizeInBits > 32)
|
||||||
Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, Op.getValueType(), Sign);
|
Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, Op.getValueType(), Sign);
|
||||||
unsigned ShVal = Op.getValueType().getSizeInBits()-1;
|
unsigned ShVal = Op.getValueType().getSizeInBits()-1;
|
||||||
SDValue ShAmt = TLO.DAG.getConstant(ShVal, Op.getValueType());
|
SDValue ShAmt = TLO.DAG.getConstant(ShVal, Op.getValueType());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user