1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
4 define i32 @test(i32 %a, i8 %b, i8 %c) {
5 ; CHECK-LABEL: define i32 @test(
6 ; CHECK-SAME: i32 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]]) {
8 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i8> poison, i8 [[C]], i32 0
9 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i8> [[TMP0]], <4 x i8> poison, <4 x i32> zeroinitializer
10 ; CHECK-NEXT: [[TMP2:%.*]] = add <4 x i8> [[TMP1]], <i8 -1, i8 -2, i8 -3, i8 -4>
11 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i8> poison, i8 [[B]], i32 0
12 ; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x i8> [[TMP3]], <4 x i8> poison, <4 x i32> zeroinitializer
13 ; CHECK-NEXT: [[TMP8:%.*]] = zext <4 x i8> [[TMP2]] to <4 x i16>
14 ; CHECK-NEXT: [[TMP9:%.*]] = sext <4 x i8> [[TMP4]] to <4 x i16>
15 ; CHECK-NEXT: [[TMP5:%.*]] = icmp sle <4 x i16> [[TMP8]], [[TMP9]]
16 ; CHECK-NEXT: [[TMP6:%.*]] = zext <4 x i1> [[TMP5]] to <4 x i32>
17 ; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP6]])
18 ; CHECK-NEXT: [[OP_RDX:%.*]] = add i32 [[TMP7]], [[A]]
19 ; CHECK-NEXT: ret i32 [[OP_RDX]]
23 %dec19 = add i8 %c, -1
24 %conv20 = zext i8 %dec19 to i32
25 %conv16.1 = sext i8 %b to i32
26 %cmp17.1 = icmp sle i32 %conv20, %conv16.1
27 %conv18.1 = zext i1 %cmp17.1 to i32
28 %a.1 = add nsw i32 %conv18.1, %a
29 %dec19.1 = add i8 %c, -2
30 %conv20.1 = zext i8 %dec19.1 to i32
31 %conv16.2 = sext i8 %b to i32
32 %cmp17.2 = icmp sle i32 %conv20.1, %conv16.2
33 %conv18.2 = zext i1 %cmp17.2 to i32
34 %a.2 = add nsw i32 %a.1, %conv18.2
35 %1 = zext i8 %0 to i32
36 %conv16.158 = sext i8 %b to i32
37 %cmp17.159 = icmp sle i32 %1, %conv16.158
38 %conv18.160 = zext i1 %cmp17.159 to i32
39 %a.161 = add nsw i32 %a.2, %conv18.160
40 %dec19.162 = add i8 %c, -4
41 %conv20.163 = zext i8 %dec19.162 to i32
42 %conv16.1.1 = sext i8 %b to i32
43 %cmp17.1.1 = icmp sle i32 %conv20.163, %conv16.1.1
44 %conv18.1.1 = zext i1 %cmp17.1.1 to i32
45 %a.1.1 = add nsw i32 %a.161, %conv18.1.1