1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mattr=+avx < %s | FileCheck %s
4 define void @test(ptr %0, ptr %1, ptr %2) {
6 ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, ptr [[TMP0:%.*]], i64 4
7 ; CHECK-NEXT: [[TMP6:%.*]] = load <4 x i32>, ptr [[TMP1:%.*]], align 4
8 ; CHECK-NEXT: [[TMP8:%.*]] = load <4 x i32>, ptr [[TMP0]], align 4
9 ; CHECK-NEXT: [[TMP10:%.*]] = load <4 x i32>, ptr [[TMP4]], align 4
10 ; CHECK-NEXT: [[TMP11:%.*]] = sub <4 x i32> <i32 0, i32 0, i32 undef, i32 0>, [[TMP8]]
11 ; CHECK-NEXT: [[TMP12:%.*]] = sub <4 x i32> [[TMP11]], [[TMP10]]
12 ; CHECK-NEXT: [[TMP13:%.*]] = add <4 x i32> [[TMP12]], [[TMP6]]
13 ; CHECK-NEXT: [[TMP14:%.*]] = add <4 x i32> [[TMP13]], <i32 0, i32 0, i32 1, i32 0>
14 ; CHECK-NEXT: [[TMP15:%.*]] = sub <4 x i32> [[TMP13]], <i32 0, i32 0, i32 1, i32 0>
15 ; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <4 x i32> [[TMP14]], <4 x i32> [[TMP15]], <4 x i32> <i32 2, i32 0, i32 1, i32 7>
16 ; CHECK-NEXT: [[TMP17:%.*]] = add <4 x i32> [[TMP16]], zeroinitializer
17 ; CHECK-NEXT: [[TMP18:%.*]] = sub <4 x i32> [[TMP16]], zeroinitializer
18 ; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <4 x i32> [[TMP17]], <4 x i32> [[TMP18]], <4 x i32> <i32 0, i32 5, i32 6, i32 7>
19 ; CHECK-NEXT: [[TMP20:%.*]] = add <4 x i32> [[TMP19]], zeroinitializer
20 ; CHECK-NEXT: [[TMP21:%.*]] = sub <4 x i32> [[TMP19]], zeroinitializer
21 ; CHECK-NEXT: [[TMP22:%.*]] = shufflevector <4 x i32> [[TMP20]], <4 x i32> [[TMP21]], <4 x i32> <i32 0, i32 5, i32 6, i32 3>
22 ; CHECK-NEXT: store <4 x i32> [[TMP22]], ptr [[TMP2:%.*]], align 4
23 ; CHECK-NEXT: ret void
25 %4 = load i32, ptr %1, align 4
26 %5 = load i32, ptr %0, align 4
27 %6 = getelementptr inbounds i32, ptr %0, i64 4
28 %7 = load i32, ptr %6, align 4
29 %8 = getelementptr inbounds i32, ptr %1, i64 1
30 %9 = load i32, ptr %8, align 4
31 %10 = getelementptr inbounds i32, ptr %0, i64 1
32 %11 = load i32, ptr %10, align 4
33 %12 = getelementptr inbounds i32, ptr %0, i64 5
34 %13 = load i32, ptr %12, align 4
35 %14 = getelementptr inbounds i32, ptr %1, i64 2
36 %15 = load i32, ptr %14, align 4
37 %16 = getelementptr inbounds i32, ptr %0, i64 2
38 %17 = load i32, ptr %16, align 4
39 %18 = getelementptr inbounds i32, ptr %0, i64 6
40 %19 = load i32, ptr %18, align 4
41 %20 = getelementptr inbounds i32, ptr %1, i64 3
42 %21 = load i32, ptr %20, align 4
43 %22 = getelementptr inbounds i32, ptr %0, i64 3
44 %23 = load i32, ptr %22, align 4
45 %24 = getelementptr inbounds i32, ptr %0, i64 7
46 %25 = load i32, ptr %24, align 4
48 %27 = sub i32 %26, %25
49 %28 = add i32 %27, %21
50 %29 = sub i32 undef, %17
51 %30 = sub i32 %29, %19
52 %31 = add i32 %30, %15
54 %33 = sub i32 %32, %13
62 store i32 %40, ptr %2, align 4
63 %41 = getelementptr inbounds i32, ptr %2, i64 2
67 store i32 %44, ptr %41, align 4
68 %45 = getelementptr inbounds i32, ptr %2, i64 1
72 store i32 %48, ptr %45, align 4
73 %49 = getelementptr inbounds i32, ptr %2, i64 3
77 store i32 %52, ptr %49, align 4