summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2018-09-11 15:32:47 +0000
committerSimon Atanasyan <simon@atanasyan.com>2018-09-11 15:32:47 +0000
commit16c2311c59eb4cd6d9c63e39b2682b89a5b08e9b (patch)
tree17f0d44206adb705641dac04291ca4e24a69e038 /llvm/lib/Target/Mips
parenteac270caf45ce957daf3c01b01a5752a818344bd (diff)
downloadbcm5719-llvm-16c2311c59eb4cd6d9c63e39b2682b89a5b08e9b.tar.gz
bcm5719-llvm-16c2311c59eb4cd6d9c63e39b2682b89a5b08e9b.zip
[MIPS] Fix illegal type assert in single-float mode
An fp_to_sint node would be incorrectly lowered to a TruncIntFP node in single-float mode. This would trigger an "Unexpected illegal type!" assert. Patch by Dan Ravensloft. Differential revision: https://reviews.llvm.org/D51810 llvm-svn: 341952
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/MipsISelLowering.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 0677d378a11..104fa4090ec 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -2563,10 +2563,12 @@ static SDValue lowerUnalignedIntStore(StoreSDNode *SD, SelectionDAG &DAG,
}
// Lower (store (fp_to_sint $fp) $ptr) to (store (TruncIntFP $fp), $ptr).
-static SDValue lowerFP_TO_SINT_STORE(StoreSDNode *SD, SelectionDAG &DAG) {
+static SDValue lowerFP_TO_SINT_STORE(StoreSDNode *SD, SelectionDAG &DAG,
+ bool SingleFloat) {
SDValue Val = SD->getValue();
- if (Val.getOpcode() != ISD::FP_TO_SINT)
+ if (Val.getOpcode() != ISD::FP_TO_SINT ||
+ (Val.getValueSizeInBits() > 32 && SingleFloat))
return SDValue();
EVT FPTy = EVT::getFloatingPointVT(Val.getValueSizeInBits());
@@ -2587,7 +2589,7 @@ SDValue MipsTargetLowering::lowerSTORE(SDValue Op, SelectionDAG &DAG) const {
((MemVT == MVT::i32) || (MemVT == MVT::i64)))
return lowerUnalignedIntStore(SD, DAG, Subtarget.isLittle());
- return lowerFP_TO_SINT_STORE(SD, DAG);
+ return lowerFP_TO_SINT_STORE(SD, DAG, Subtarget.isSingleFloat());
}
SDValue MipsTargetLowering::lowerEH_DWARF_CFA(SDValue Op,
@@ -2603,6 +2605,9 @@ SDValue MipsTargetLowering::lowerEH_DWARF_CFA(SDValue Op,
SDValue MipsTargetLowering::lowerFP_TO_SINT(SDValue Op,
SelectionDAG &DAG) const {
+ if (Op.getValueSizeInBits() > 32 && Subtarget.isSingleFloat())
+ return SDValue();
+
EVT FPTy = EVT::getFloatingPointVT(Op.getValueSizeInBits());
SDValue Trunc = DAG.getNode(MipsISD::TruncIntFP, SDLoc(Op), FPTy,
Op.getOperand(0));
OpenPOWER on IntegriCloud