1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S -mtriple=aarch64-apple-ios -mcpu=cyclone -o - %s | FileCheck %s
4 define void @f1(<2 x i16> %x, ptr %a) {
6 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i16> [[X:%.*]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 0>
7 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i16> [[X]], i32 0
8 ; CHECK-NEXT: store i16 [[TMP1]], ptr [[A:%.*]], align 2
9 ; CHECK-NEXT: store <4 x i16> [[SHUFFLE]], ptr undef, align 2
10 ; CHECK-NEXT: ret void
12 %t2 = extractelement <2 x i16> %x, i32 0
13 %t3 = extractelement <2 x i16> %x, i32 1
14 %ptr1 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 1
15 %ptr2 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 2
16 %ptr3 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 3
18 store i16 %t2, ptr undef
19 store i16 %t3, ptr %ptr1
20 store i16 %t3, ptr %ptr2
21 store i16 %t2, ptr %ptr3
25 define void @f2(<2 x i16> %x, ptr %a) {
28 ; CHECK-NEXT: br label [[CONT:%.*]]
30 ; CHECK-NEXT: [[XX:%.*]] = phi <2 x i16> [ [[X:%.*]], [[ENTRY:%.*]] ], [ undef, [[CONT]] ]
31 ; CHECK-NEXT: [[AA:%.*]] = phi ptr [ [[A:%.*]], [[ENTRY]] ], [ undef, [[CONT]] ]
32 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i16> [[XX]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 0>
33 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i16> [[XX]], i32 0
34 ; CHECK-NEXT: store i16 [[TMP0]], ptr [[A]], align 2
35 ; CHECK-NEXT: store <4 x i16> [[SHUFFLE]], ptr undef, align 2
36 ; CHECK-NEXT: [[A_VAL:%.*]] = load i16, ptr [[A]], align 2
37 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[A_VAL]], 0
38 ; CHECK-NEXT: br i1 [[CMP]], label [[CONT]], label [[EXIT:%.*]]
40 ; CHECK-NEXT: ret void
45 cont: ; preds = %entry, %cont
46 %xx = phi <2 x i16> [ %x, %entry ], [ undef, %cont ]
47 %aa = phi ptr [ %a, %entry ], [ undef, %cont ]
48 %t2 = extractelement <2 x i16> %xx, i32 0
49 %t3 = extractelement <2 x i16> %xx, i32 1
50 %ptr1 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 1
51 %ptr2 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 2
52 %ptr3 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 3
54 store i16 %t2, ptr undef
55 store i16 %t3, ptr %ptr1
56 store i16 %t3, ptr %ptr2
57 store i16 %t2, ptr %ptr3
58 %a_val = load i16, ptr %a, align 2
59 %cmp = icmp eq i16 %a_val, 0
60 br i1 %cmp, label %cont, label %exit
66 define void @f3(<2 x i16> %x, ptr %a) {
69 ; CHECK-NEXT: br label [[CONT:%.*]]
71 ; CHECK-NEXT: [[XX:%.*]] = phi <2 x i16> [ [[X:%.*]], [[ENTRY:%.*]] ], [ undef, [[CONT]] ]
72 ; CHECK-NEXT: [[AA:%.*]] = phi ptr [ [[A:%.*]], [[ENTRY]] ], [ undef, [[CONT]] ]
73 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i16> [[XX]], <2 x i16> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 1>
74 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i16> [[XX]], i32 1
75 ; CHECK-NEXT: store i16 [[TMP0]], ptr [[A]], align 2
76 ; CHECK-NEXT: store <4 x i16> [[SHUFFLE]], ptr undef, align 2
77 ; CHECK-NEXT: [[A_VAL:%.*]] = load i16, ptr [[A]], align 2
78 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[A_VAL]], 0
79 ; CHECK-NEXT: br i1 [[CMP]], label [[CONT]], label [[EXIT:%.*]]
81 ; CHECK-NEXT: ret void
86 cont: ; preds = %entry, %cont
87 %xx = phi <2 x i16> [ %x, %entry ], [ undef, %cont ]
88 %aa = phi ptr [ %a, %entry ], [ undef, %cont ]
89 %t2 = extractelement <2 x i16> %xx, i32 0
90 %t3 = extractelement <2 x i16> %xx, i32 1
91 %ptr1 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 1
92 %ptr2 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 2
93 %ptr3 = getelementptr inbounds [4 x i16], ptr undef, i16 0, i16 3
95 store i16 %t3, ptr undef
96 store i16 %t2, ptr %ptr1
97 store i16 %t2, ptr %ptr2
98 store i16 %t3, ptr %ptr3
99 %a_val = load i16, ptr %a, align 2
100 %cmp = icmp eq i16 %a_val, 0
101 br i1 %cmp, label %cont, label %exit
103 exit: ; preds = %cont