1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: %if x86-registered-target %{ opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -S --passes=slp-vectorizer -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s %}
5 define i32 @test(ptr %sptr, i64 %0) {
6 ; CHECK-LABEL: define i32 @test(
7 ; CHECK-SAME: ptr [[SPTR:%.*]], i64 [[TMP0:%.*]]) {
9 ; CHECK-NEXT: [[CONV_I:%.*]] = trunc i64 [[TMP0]] to i32
10 ; CHECK-NEXT: [[IV2:%.*]] = getelementptr i8, ptr [[SPTR]], i64 4
11 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[IV2]], align 4
12 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> [[TMP1]], i32 [[CONV_I]], i32 1
13 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 1>
14 ; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> [[TMP1]], <4 x i32> <i32 1, i32 5, i32 1, i32 poison>
15 ; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP4]], <4 x i32> <i32 poison, i32 poison, i32 poison, i32 0>, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
16 ; CHECK-NEXT: [[TMP7:%.*]] = icmp slt <4 x i32> [[TMP3]], [[TMP5]]
17 ; CHECK-NEXT: [[TMP12:%.*]] = icmp sle <4 x i32> [[TMP3]], [[TMP5]]
18 ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <4 x i1> [[TMP7]], <4 x i1> [[TMP12]], <4 x i32> <i32 0, i32 1, i32 6, i32 3>
19 ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq <4 x i32> [[TMP1]], zeroinitializer
20 ; CHECK-NEXT: [[TMP10:%.*]] = or <4 x i1> [[TMP9]], [[TMP8]]
21 ; CHECK-NEXT: [[TMP11:%.*]] = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> [[TMP10]])
22 ; CHECK-NEXT: [[AND33:%.*]] = zext i1 [[TMP11]] to i32
23 ; CHECK-NEXT: ret i32 [[AND33]]
26 %conv.i = trunc i64 %0 to i32
27 %iv2 = getelementptr i8, ptr %sptr, i64 4
28 %1 = load i32, ptr %iv2, align 4
29 %cmp11 = icmp slt i32 %1, %conv.i
30 %cmp.i57 = icmp eq i32 %1, 0
31 %or.i5977 = or i1 %cmp.i57, %cmp11
32 %iv4 = getelementptr i8, ptr %sptr, i64 12
33 %2 = load i32, ptr %iv4, align 4
34 %cmp16 = icmp sle i32 %2, %conv.i
35 %cmp.i62 = icmp eq i32 %2, 0
36 %or.i6478 = or i1 %cmp.i62, %cmp16
37 %iv3 = getelementptr i8, ptr %sptr, i64 8
38 %3 = load i32, ptr %iv3, align 8
39 %cmp21 = icmp sgt i32 %3, %conv.i
40 %cmp.i67 = icmp eq i32 %3, 0
41 %or.i6979 = or i1 %cmp.i67, %cmp21
42 %iv5 = getelementptr i8, ptr %sptr, i64 16
43 %4 = load i32, ptr %iv5, align 8
44 %cmp26 = icmp slt i32 %conv.i, 0
45 %cmp.i72 = icmp eq i32 %4, 0
46 %or.i7480 = or i1 %cmp.i72, %cmp26
47 %and3183 = and i1 %or.i5977, %or.i6478
48 %and3284 = and i1 %and3183, %or.i6979
49 %and3385 = and i1 %and3284, %or.i7480
50 %and33 = zext i1 %and3385 to i32