1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=slp-vectorizer -mtriple=x86_64-apple-macosx -mattr=+avx2 < %s | FileCheck %s
4 define i64 @foo(i32 %tmp7) {
7 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> <i32 0, i32 0, i32 poison, i32 0>, i32 [[TMP5:%.*]], i32 2
8 ; CHECK-NEXT: [[TMP3:%.*]] = sub <4 x i32> [[TMP2]], zeroinitializer
9 ; CHECK-NEXT: [[TMP24:%.*]] = sub i32 undef, 0
10 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 poison, i32 poison, i32 undef, i32 0>, i32 [[TMP24]], i32 4
11 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x i32> [[TMP0]], i32 0, i32 5
12 ; CHECK-NEXT: [[TMP11:%.*]] = insertelement <8 x i32> <i32 poison, i32 poison, i32 undef, i32 poison, i32 poison, i32 undef, i32 poison, i32 undef>, i32 [[TMP24]], i32 6
13 ; CHECK-NEXT: [[TMP12:%.*]] = call <8 x i32> @llvm.vector.insert.v8i32.v4i32(<8 x i32> poison, <4 x i32> [[TMP3]], i64 0)
14 ; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[TMP12]], <8 x i32> [[TMP11]], <8 x i32> <i32 0, i32 1, i32 poison, i32 2, i32 3, i32 poison, i32 14, i32 poison>
15 ; CHECK-NEXT: [[TMP5:%.*]] = add nsw <8 x i32> [[TMP1]], [[TMP4]]
16 ; CHECK-NEXT: [[TMP6:%.*]] = sub nsw <8 x i32> [[TMP1]], [[TMP4]]
17 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <8 x i32> [[TMP5]], <8 x i32> [[TMP6]], <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 4, i32 5, i32 14, i32 15>
18 ; CHECK-NEXT: [[TMP8:%.*]] = add <8 x i32> zeroinitializer, [[TMP7]]
19 ; CHECK-NEXT: [[TMP9:%.*]] = xor <8 x i32> [[TMP8]], zeroinitializer
20 ; CHECK-NEXT: [[TMP10:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP9]])
21 ; CHECK-NEXT: [[OP_RDX:%.*]] = add i32 [[TMP10]], 0
22 ; CHECK-NEXT: [[TMP64:%.*]] = zext i32 [[OP_RDX]] to i64
23 ; CHECK-NEXT: ret i64 [[TMP64]]
27 %tmp2 = sub nsw i32 0, %tmp
28 %tmp3 = add i32 0, %tmp2
29 %tmp4 = xor i32 %tmp3, 0
31 %tmp8 = sub i32 %tmp7, 0
32 %tmp9 = sub nsw i32 0, undef
33 %tmp10 = add nsw i32 0, %tmp6
34 %tmp11 = sub nsw i32 0, %tmp8
35 %tmp12 = add i32 0, %tmp10
36 %tmp13 = xor i32 %tmp12, 0
37 %tmp14 = add i32 0, %tmp9
38 %tmp15 = xor i32 %tmp14, 0
39 %tmp16 = add i32 0, %tmp11
40 %tmp17 = xor i32 %tmp16, 0
41 %tmp18 = add i32 %tmp13, %tmp4
42 %tmp19 = add i32 %tmp18, 0
43 %tmp20 = add i32 %tmp19, %tmp15
44 %tmp21 = add i32 %tmp20, %tmp17
47 %tmp24 = sub i32 undef, 0
48 %tmp25 = add nsw i32 %tmp23, undef
49 %tmp26 = add nsw i32 %tmp24, %tmp22
50 %tmp27 = sub nsw i32 undef, %tmp24
51 %tmp28 = add i32 0, %tmp25
52 %tmp29 = xor i32 %tmp28, 0
53 %tmp30 = add i32 0, %tmp26
54 %tmp31 = xor i32 %tmp30, 0
55 %tmp32 = add i32 0, %tmp27
56 %tmp33 = xor i32 %tmp32, 0
57 %tmp34 = add i32 %tmp31, %tmp21
58 %tmp35 = add i32 %tmp34, %tmp29
59 %tmp36 = add i32 %tmp35, 0
60 %tmp37 = add i32 %tmp36, %tmp33
61 %tmp38 = sub nsw i32 0, undef
62 %tmp39 = add i32 0, %tmp38
63 %tmp40 = xor i32 %tmp39, 0
64 %tmp41 = add i32 0, %tmp37
65 %tmp42 = add i32 %tmp41, 0
66 %tmp43 = add i32 %tmp42, %tmp40
67 %tmp64 = zext i32 %tmp43 to i64