1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -o - -passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
4 %class.e = type { i32, i32 }
5 %struct.a = type { i32, i32, i32, i32 }
7 define void @foo(ptr %this, ptr %p, i32 %add7) {
10 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> <i32 poison, i32 undef>, i32 [[ADD7:%.*]], i32 0
11 ; CHECK-NEXT: [[TMP1:%.*]] = sdiv <2 x i32> [[TMP0]], <i32 2, i32 2>
12 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
13 ; CHECK-NEXT: switch i32 undef, label [[SW_EPILOG:%.*]] [
14 ; CHECK-NEXT: i32 0, label [[SW_BB:%.*]]
15 ; CHECK-NEXT: i32 2, label [[SW_BB]]
18 ; CHECK-NEXT: [[TMP3:%.*]] = xor <2 x i32> [[TMP1]], <i32 -1, i32 -1>
19 ; CHECK-NEXT: [[TMP4:%.*]] = load <2 x i32>, ptr [[THIS:%.*]], align 4
20 ; CHECK-NEXT: [[TMP5:%.*]] = add <2 x i32> [[TMP4]], [[TMP3]]
21 ; CHECK-NEXT: br label [[SW_EPILOG]]
23 ; CHECK-NEXT: [[TMP6:%.*]] = phi <2 x i32> [ undef, [[ENTRY:%.*]] ], [ [[TMP5]], [[SW_BB]] ]
24 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x i32> [[TMP6]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
25 ; CHECK-NEXT: [[TMP8:%.*]] = sub <4 x i32> undef, [[TMP2]]
26 ; CHECK-NEXT: [[TMP9:%.*]] = add <4 x i32> [[TMP8]], [[TMP7]]
27 ; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <4 x i32> [[TMP9]], <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
28 ; CHECK-NEXT: store <4 x i32> [[TMP10]], ptr [[P:%.*]], align 4
29 ; CHECK-NEXT: ret void
32 %c = getelementptr inbounds %struct.a, ptr %p, i64 0, i32 1
33 %o = getelementptr inbounds %struct.a, ptr %p, i64 0, i32 2
34 %d = getelementptr inbounds %struct.a, ptr %p, i64 0, i32 3
35 %h = getelementptr inbounds %class.e, ptr %this, i64 0, i32 1
36 %div = sdiv i32 undef, 2
37 %div8 = sdiv i32 %add7, 2
38 switch i32 undef, label %sw.epilog [
44 %0 = load i32, ptr %h, align 4
46 %sub10 = add i32 %0, %1
47 %2 = load i32, ptr %this, align 4
48 %3 = xor i32 %div8, -1
49 %sub13 = add i32 %2, %3
53 %l.0 = phi i32 [ undef, %entry ], [ %sub10, %sw.bb ]
54 %m.0 = phi i32 [ undef, %entry ], [ %sub13, %sw.bb ]
55 %add15 = sub i32 undef, %div
56 %sub16 = add i32 %add15, %l.0
57 store i32 %sub16, ptr %p, align 4
58 %add19 = sub i32 undef, %div
59 %sub20 = add i32 %add19, %l.0
60 store i32 %sub20, ptr %c, align 4
61 %add23 = sub i32 undef, %div8
62 %sub24 = add i32 %add23, %m.0
63 store i32 %sub24, ptr %o, align 4
64 %add27 = sub i32 undef, %div8
65 %sub28 = add i32 %add27, %m.0
66 store i32 %sub28, ptr %d, align 4