1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: %if x86-registered-target %{ opt -S --passes=slp-vectorizer < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -S --passes=slp-vectorizer < %s -mtriple=aarch64-unknown-linux-gnu | FileCheck %s %}
6 define i1 @test(i32 %0, i32 %1, i32 %p) {
7 ; CHECK-LABEL: define i1 @test(
8 ; CHECK-SAME: i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], i32 [[P:%.*]]) {
10 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[TMP0]], 0
11 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> poison, i32 [[TMP1]], i32 0
12 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> poison, <4 x i32> zeroinitializer
13 ; CHECK-NEXT: [[TMP4:%.*]] = shl <4 x i32> zeroinitializer, [[TMP3]]
14 ; CHECK-NEXT: [[TMP5:%.*]] = icmp slt <4 x i32> [[TMP4]], zeroinitializer
15 ; CHECK-NEXT: [[CMP6:%.*]] = icmp slt i32 0, [[P]]
16 ; CHECK-NEXT: [[TMP6:%.*]] = freeze <4 x i1> [[TMP5]]
17 ; CHECK-NEXT: [[TMP7:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP6]])
18 ; CHECK-NEXT: [[OP_RDX:%.*]] = select i1 [[TMP7]], i1 true, i1 [[CMP6]]
19 ; CHECK-NEXT: [[OP_RDX1:%.*]] = select i1 [[CMP1]], i1 true, i1 [[CMP1]]
20 ; CHECK-NEXT: [[TMP8:%.*]] = freeze i1 [[OP_RDX]]
21 ; CHECK-NEXT: [[OP_RDX2:%.*]] = select i1 [[TMP8]], i1 true, i1 [[OP_RDX1]]
22 ; CHECK-NEXT: ret i1 [[OP_RDX2]]
25 %cmp1 = icmp sgt i32 %0, 0
27 %cmp2 = icmp slt i32 %shl1, 0
28 %2 = select i1 %cmp1, i1 true, i1 %cmp2
30 %cmp3 = icmp slt i32 %shl2, 0
31 %3 = select i1 %2, i1 true, i1 %cmp3
33 %cmp4 = icmp slt i32 %shl3, 0
34 %4 = select i1 %3, i1 true, i1 %cmp4
36 %cmp5 = icmp slt i32 %shl4, 0
37 %5 = select i1 %4, i1 true, i1 %cmp5
38 %cmp6 = icmp slt i32 0, %p
39 %sel = select i1 %cmp1, i1 true, i1 %cmp6