aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp9
-rw-r--r--test/CodeGen/PowerPC/pr16556.ll20
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 0f79031..9c2856f 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4685,6 +4685,15 @@ SDValue PPCTargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG,
SDLoc dl) const {
assert(Op.getOperand(0).getValueType().isFloatingPoint());
SDValue Src = Op.getOperand(0);
+
+ // If we have a long double here, it must be that we have an undef of
+ // that type. In this case return an undef of the target type.
+ if (Src.getValueType() == MVT::ppcf128) {
+ assert(Src.getOpcode() == ISD::UNDEF && "Unhandled ppcf128!");
+ return DAG.getNode(ISD::UNDEF, dl,
+ Op.getValueType().getSimpleVT().SimpleTy);
+ }
+
if (Src.getValueType() == MVT::f32)
Src = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f64, Src);
diff --git a/test/CodeGen/PowerPC/pr16556.ll b/test/CodeGen/PowerPC/pr16556.ll
new file mode 100644
index 0000000..dc36f0b
--- /dev/null
+++ b/test/CodeGen/PowerPC/pr16556.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s
+
+; This test formerly failed due to no handling for a ppc_fp128 undef.
+
+target datalayout = "E-p:32:32:32-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:64:128-v64:64:64-v128:128:128-a0:0:64-n32"
+target triple = "powerpc-unknown-linux-gnu"
+
+%core.time.TickDuration.37.125 = type { i64 }
+
+define weak_odr fastcc i64 @_D4core4time12TickDuration30__T2toVAyaa7_7365636f6e6473TlZ2toMxFNaNbNfZl(%core.time.TickDuration.37.125* %.this_arg) {
+entry:
+ br i1 undef, label %noassert, label %assert
+
+assert: ; preds = %entry
+ unreachable
+
+noassert: ; preds = %entry
+ %tmp9 = fptosi ppc_fp128 undef to i64
+ ret i64 %tmp9
+}