Skip to content

Commit 781c794

Browse files
committed
[DAGTypeLegalize] Legalize ISD::POISON as ISD::UNDEF for Float Type
Legalization
1 parent 2d9bdc6 commit 781c794

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
165165
case ISD::STRICT_UINT_TO_FP:
166166
case ISD::SINT_TO_FP:
167167
case ISD::UINT_TO_FP: R = SoftenFloatRes_XINT_TO_FP(N); break;
168+
case ISD::POISON:
168169
case ISD::UNDEF: R = SoftenFloatRes_UNDEF(N); break;
169170
case ISD::VAARG: R = SoftenFloatRes_VAARG(N); break;
170171
case ISD::VECREDUCE_FADD:
@@ -1501,6 +1502,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
15011502
report_fatal_error("Do not know how to expand the result of this "
15021503
"operator!");
15031504
// clang-format off
1505+
case ISD::POISON:
15041506
case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break;
15051507
case ISD::SELECT: SplitRes_Select(N, Lo, Hi); break;
15061508
case ISD::SELECT_CC: SplitRes_SELECT_CC(N, Lo, Hi); break;
@@ -3319,6 +3321,7 @@ void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
33193321
case ISD::STRICT_UINT_TO_FP:
33203322
case ISD::SINT_TO_FP:
33213323
case ISD::UINT_TO_FP: R = SoftPromoteHalfRes_XINT_TO_FP(N); break;
3324+
case ISD::POISON:
33223325
case ISD::UNDEF: R = SoftPromoteHalfRes_UNDEF(N); break;
33233326
case ISD::ATOMIC_SWAP: R = BitcastToInt_ATOMIC_SWAP(N); break;
33243327
case ISD::VECREDUCE_FADD:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s
2+
3+
define void @ExpandFloat(ptr %p1 ) {
4+
; CHECK: stfd 0, 8(3)
5+
; CHECK-NEXT: stfd 0, 0(3)
6+
; CHECK-NEXT: blr
7+
entry:
8+
store volatile ppc_fp128 poison, ptr %p1
9+
ret void
10+
}
11+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; RUN: llc < %s -mtriple=riscv32 | FileCheck %s
2+
3+
define void @SoftenFloat(ptr %p1) {
4+
; CHECK-LABEL: SoftenFloat:
5+
; CHECK: # %bb.0: # %entry
6+
; CHECK-NEXT: sw a0, 4(a0)
7+
; CHECK-NEXT: sw a0, 0(a0)
8+
; CHECK-NEXT: ret
9+
10+
entry:
11+
store volatile double poison, ptr %p1
12+
ret void
13+
}
14+
15+
define void @PromoteHalf(ptr %p1 ) {
16+
; CHECK-LABEL: PromoteHalf:
17+
; CHECK: # %bb.0: # %entry
18+
; CHECK-NEXT: sh a0, 0(a0)
19+
; CHECK-NEXT: ret
20+
entry:
21+
store volatile half poison, ptr %p1
22+
ret void
23+
}
24+

0 commit comments

Comments
 (0)