Skip to content

Commit 012b53b

Browse files
committed
[DAG] Allow AssertZExt to scalarize.
With range and undef metadata on a call we can have vector AssertZExt generated on a target with no vector operations. The AssertZExt needs to scalarize to a normal `AssertZext tin, ValueType`. I have added AssertSext too, although I do not have a test case.
1 parent 2e6030e commit 012b53b

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
5858
case ISD::BUILD_VECTOR: R = ScalarizeVecRes_BUILD_VECTOR(N); break;
5959
case ISD::EXTRACT_SUBVECTOR: R = ScalarizeVecRes_EXTRACT_SUBVECTOR(N); break;
6060
case ISD::FP_ROUND: R = ScalarizeVecRes_FP_ROUND(N); break;
61-
case ISD::FPOWI: R = ScalarizeVecRes_ExpOp(N); break;
61+
case ISD::AssertZext:
62+
case ISD::AssertSext:
63+
case ISD::FPOWI:
64+
R = ScalarizeVecRes_ExpOp(N);
65+
break;
6266
case ISD::INSERT_VECTOR_ELT: R = ScalarizeVecRes_INSERT_VECTOR_ELT(N); break;
6367
case ISD::LOAD: R = ScalarizeVecRes_LOAD(cast<LoadSDNode>(N));break;
6468
case ISD::SCALAR_TO_VECTOR: R = ScalarizeVecRes_SCALAR_TO_VECTOR(N); break;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=armv7-unknown-linux-musleabihf -mattr=-neon %s -o - | FileCheck %s
3+
4+
declare fastcc noundef range(i16 0, 256) <4 x i16> @other()
5+
6+
define void @test(ptr %0) #0 {
7+
; CHECK-LABEL: test:
8+
; CHECK: @ %bb.0: @ %entry
9+
; CHECK-NEXT: .save {r4, lr}
10+
; CHECK-NEXT: push {r4, lr}
11+
; CHECK-NEXT: mov r4, r0
12+
; CHECK-NEXT: bl other
13+
; CHECK-NEXT: uxth r3, r3
14+
; CHECK-NEXT: uxth r2, r2
15+
; CHECK-NEXT: uxth r1, r1
16+
; CHECK-NEXT: uxth r0, r0
17+
; CHECK-NEXT: strb r3, [r4, #3]
18+
; CHECK-NEXT: strb r2, [r4, #2]
19+
; CHECK-NEXT: strb r1, [r4, #1]
20+
; CHECK-NEXT: strb r0, [r4]
21+
; CHECK-NEXT: pop {r4, pc}
22+
entry:
23+
%call33.i70 = call fastcc <4 x i16> @other()
24+
%conv.i.i.i71 = trunc <4 x i16> %call33.i70 to <4 x i8>
25+
store <4 x i8> %conv.i.i.i71, ptr %0, align 1
26+
ret void
27+
}
28+

0 commit comments

Comments
 (0)