1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S < %s --passes=slp-vectorizer | FileCheck %s
4 define i1 @test(i32 %x) {
5 ; CHECK-LABEL: define i1 @test(
6 ; CHECK-SAME: i32 [[X:%.*]]) {
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[X]], 1
8 ; CHECK-NEXT: [[OP_RDX:%.*]] = select i1 [[CMP]], i1 true, i1 poison
9 ; CHECK-NEXT: ret i1 [[OP_RDX]]
11 %cmp = icmp sgt i32 %x, 1
12 %sel1 = select i1 %cmp, i1 true, i1 poison
13 %sel2 = select i1 %sel1, i1 true, i1 poison
14 %sel3 = select i1 %sel2, i1 true, i1 poison
15 %sel4 = select i1 %cmp, i1 true, i1 poison
16 %ret = or i1 %sel3, %sel4
20 define i1 @test1(i32 %x, i32 %a, i32 %b, i32 %c, i32 %d) {
21 ; CHECK-LABEL: define i1 @test1(
22 ; CHECK-SAME: i32 [[X:%.*]], i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], i32 [[D:%.*]]) {
23 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32> poison, i32 [[X]], i32 0
24 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> [[TMP1]], i32 [[A]], i32 1
25 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> [[TMP2]], i32 [[B]], i32 2
26 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x i32> [[TMP3]], i32 [[C]], i32 3
27 ; CHECK-NEXT: [[TMP5:%.*]] = icmp sgt <4 x i32> [[TMP4]], <i32 1, i32 1, i32 1, i32 1>
28 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sgt i32 [[D]], 1
29 ; CHECK-NEXT: [[TMP6:%.*]] = freeze <4 x i1> [[TMP5]]
30 ; CHECK-NEXT: [[TMP7:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP6]])
31 ; CHECK-NEXT: [[OP_RDX:%.*]] = select i1 [[TMP7]], i1 true, i1 [[CMP3]]
32 ; CHECK-NEXT: ret i1 [[OP_RDX]]
34 %cmp = icmp sgt i32 %x, 1
35 %cmp1 = icmp sgt i32 %a, 1
36 %cmp2 = icmp sgt i32 %b, 1
37 %cmp3 = icmp sgt i32 %c, 1
38 %cmp4 = icmp sgt i32 %d, 1
39 %sel1 = select i1 %cmp, i1 true, i1 %cmp1
40 %sel2 = select i1 %sel1, i1 true, i1 %cmp2
41 %sel3 = select i1 %sel2, i1 true, i1 %cmp3
42 %sel4 = select i1 %cmp, i1 true, i1 %cmp4
43 %ret = or i1 %sel3, %sel4