1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S %s | FileCheck %s
3 ; RUN: opt -aa-pipeline=basic-aa -passes='slp-vectorizer' -S %s | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 target triple = "arm64-apple-ios5.0.0"
8 ; Some negative tests first.
10 ; We need selects with a uniform predicate to lower effectively to vector
12 define void @select_mixed_predicates_8xi16(ptr %ptr, i16 %x) {
13 ; CHECK-LABEL: @select_mixed_predicates_8xi16(
15 ; CHECK-NEXT: [[L_0:%.*]] = load i16, ptr [[PTR:%.*]], align 2
16 ; CHECK-NEXT: [[CMP_0:%.*]] = icmp ult i16 [[L_0]], 16383
17 ; CHECK-NEXT: [[S_0:%.*]] = select i1 [[CMP_0]], i16 [[L_0]], i16 [[X:%.*]]
18 ; CHECK-NEXT: store i16 [[S_0]], ptr [[PTR]], align 2
19 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 1
20 ; CHECK-NEXT: [[L_1:%.*]] = load i16, ptr [[GEP_1]], align 2
21 ; CHECK-NEXT: [[CMP_1:%.*]] = icmp sgt i16 [[L_1]], 16383
22 ; CHECK-NEXT: [[S_1:%.*]] = select i1 [[CMP_1]], i16 [[L_1]], i16 [[X]]
23 ; CHECK-NEXT: store i16 [[S_1]], ptr [[GEP_1]], align 2
24 ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 2
25 ; CHECK-NEXT: [[L_2:%.*]] = load i16, ptr [[GEP_2]], align 2
26 ; CHECK-NEXT: [[CMP_2:%.*]] = icmp eq i16 [[L_2]], 16383
27 ; CHECK-NEXT: [[S_2:%.*]] = select i1 [[CMP_2]], i16 [[L_2]], i16 [[X]]
28 ; CHECK-NEXT: store i16 [[S_2]], ptr [[GEP_2]], align 2
29 ; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 3
30 ; CHECK-NEXT: [[L_3:%.*]] = load i16, ptr [[GEP_3]], align 2
31 ; CHECK-NEXT: [[CMP_3:%.*]] = icmp ne i16 [[L_3]], 16383
32 ; CHECK-NEXT: [[S_3:%.*]] = select i1 [[CMP_3]], i16 [[L_3]], i16 [[X]]
33 ; CHECK-NEXT: store i16 [[S_3]], ptr [[GEP_3]], align 2
34 ; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 4
35 ; CHECK-NEXT: [[L_4:%.*]] = load i16, ptr [[GEP_4]], align 2
36 ; CHECK-NEXT: [[CMP_4:%.*]] = icmp eq i16 [[L_4]], 16383
37 ; CHECK-NEXT: [[S_4:%.*]] = select i1 [[CMP_4]], i16 [[L_4]], i16 [[X]]
38 ; CHECK-NEXT: store i16 [[S_4]], ptr [[GEP_4]], align 2
39 ; CHECK-NEXT: [[GEP_5:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 5
40 ; CHECK-NEXT: [[L_5:%.*]] = load i16, ptr [[GEP_5]], align 2
41 ; CHECK-NEXT: [[CMP_5:%.*]] = icmp ule i16 [[L_5]], 16383
42 ; CHECK-NEXT: [[S_5:%.*]] = select i1 [[CMP_5]], i16 [[L_5]], i16 [[X]]
43 ; CHECK-NEXT: store i16 [[S_5]], ptr [[GEP_5]], align 2
44 ; CHECK-NEXT: [[GEP_6:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 6
45 ; CHECK-NEXT: [[L_6:%.*]] = load i16, ptr [[GEP_6]], align 2
46 ; CHECK-NEXT: [[CMP_6:%.*]] = icmp ult i16 [[L_6]], 16383
47 ; CHECK-NEXT: [[S_6:%.*]] = select i1 [[CMP_6]], i16 [[L_6]], i16 [[X]]
48 ; CHECK-NEXT: store i16 [[S_6]], ptr [[GEP_6]], align 2
49 ; CHECK-NEXT: [[GEP_7:%.*]] = getelementptr inbounds i16, ptr [[PTR]], i16 7
50 ; CHECK-NEXT: [[L_7:%.*]] = load i16, ptr [[GEP_7]], align 2
51 ; CHECK-NEXT: [[CMP_7:%.*]] = icmp ult i16 [[L_7]], 16383
52 ; CHECK-NEXT: [[S_7:%.*]] = select i1 [[CMP_7]], i16 [[L_7]], i16 [[X]]
53 ; CHECK-NEXT: store i16 [[S_7]], ptr [[GEP_7]], align 2
54 ; CHECK-NEXT: ret void
57 %l.0 = load i16, ptr %ptr
58 %cmp.0 = icmp ult i16 %l.0, 16383
59 %s.0 = select i1 %cmp.0, i16 %l.0, i16 %x
60 store i16 %s.0, ptr %ptr, align 2
62 %gep.1 = getelementptr inbounds i16, ptr %ptr, i16 1
63 %l.1 = load i16, ptr %gep.1
64 %cmp.1 = icmp sgt i16 %l.1, 16383
65 %s.1 = select i1 %cmp.1, i16 %l.1, i16 %x
66 store i16 %s.1, ptr %gep.1, align 2
68 %gep.2 = getelementptr inbounds i16, ptr %ptr, i16 2
69 %l.2 = load i16, ptr %gep.2
70 %cmp.2 = icmp eq i16 %l.2, 16383
71 %s.2 = select i1 %cmp.2, i16 %l.2, i16 %x
72 store i16 %s.2, ptr %gep.2, align 2
74 %gep.3 = getelementptr inbounds i16, ptr %ptr, i16 3
75 %l.3 = load i16, ptr %gep.3
76 %cmp.3 = icmp ne i16 %l.3, 16383
77 %s.3 = select i1 %cmp.3, i16 %l.3, i16 %x
78 store i16 %s.3, ptr %gep.3, align 2
80 %gep.4 = getelementptr inbounds i16, ptr %ptr, i16 4
81 %l.4 = load i16, ptr %gep.4
82 %cmp.4 = icmp eq i16 %l.4, 16383
83 %s.4 = select i1 %cmp.4, i16 %l.4, i16 %x
84 store i16 %s.4, ptr %gep.4, align 2
86 %gep.5 = getelementptr inbounds i16, ptr %ptr, i16 5
87 %l.5 = load i16, ptr %gep.5
88 %cmp.5 = icmp ule i16 %l.5, 16383
89 %s.5 = select i1 %cmp.5, i16 %l.5, i16 %x
90 store i16 %s.5, ptr %gep.5, align 2
92 %gep.6 = getelementptr inbounds i16, ptr %ptr, i16 6
93 %l.6 = load i16, ptr %gep.6
94 %cmp.6 = icmp ult i16 %l.6, 16383
95 %s.6 = select i1 %cmp.6, i16 %l.6, i16 %x
96 store i16 %s.6, ptr %gep.6, align 2
98 %gep.7 = getelementptr inbounds i16, ptr %ptr, i16 7
99 %l.7 = load i16, ptr %gep.7
100 %cmp.7 = icmp ult i16 %l.7, 16383
101 %s.7 = select i1 %cmp.7, i16 %l.7, i16 %x
102 store i16 %s.7, ptr %gep.7, align 2
106 define void @select_uniform_ugt_7xi8(ptr %ptr, i8 %x) {
107 ; CHECK-LABEL: @select_uniform_ugt_7xi8(
109 ; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i8>, ptr [[PTR:%.*]], align 1
110 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <4 x i8> [[TMP0]], <i8 -1, i8 -1, i8 -1, i8 -1>
111 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i8> poison, i8 [[X:%.*]], i32 0
112 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i8> [[TMP2]], <4 x i8> poison, <4 x i32> zeroinitializer
113 ; CHECK-NEXT: [[TMP4:%.*]] = select <4 x i1> [[TMP1]], <4 x i8> [[TMP0]], <4 x i8> [[TMP3]]
114 ; CHECK-NEXT: store <4 x i8> [[TMP4]], ptr [[PTR]], align 2
115 ; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 4
116 ; CHECK-NEXT: [[L_4:%.*]] = load i8, ptr [[GEP_4]], align 1
117 ; CHECK-NEXT: [[CMP_4:%.*]] = icmp ugt i8 [[L_4]], -1
118 ; CHECK-NEXT: [[S_4:%.*]] = select i1 [[CMP_4]], i8 [[L_4]], i8 [[X]]
119 ; CHECK-NEXT: store i8 [[S_4]], ptr [[GEP_4]], align 2
120 ; CHECK-NEXT: [[GEP_5:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 5
121 ; CHECK-NEXT: [[L_5:%.*]] = load i8, ptr [[GEP_5]], align 1
122 ; CHECK-NEXT: [[CMP_5:%.*]] = icmp ugt i8 [[L_5]], -1
123 ; CHECK-NEXT: [[S_5:%.*]] = select i1 [[CMP_5]], i8 [[L_5]], i8 [[X]]
124 ; CHECK-NEXT: store i8 [[S_5]], ptr [[GEP_5]], align 2
125 ; CHECK-NEXT: [[GEP_6:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 6
126 ; CHECK-NEXT: [[L_6:%.*]] = load i8, ptr [[GEP_6]], align 1
127 ; CHECK-NEXT: [[CMP_6:%.*]] = icmp ugt i8 [[L_6]], -1
128 ; CHECK-NEXT: [[S_6:%.*]] = select i1 [[CMP_6]], i8 [[L_6]], i8 [[X]]
129 ; CHECK-NEXT: store i8 [[S_6]], ptr [[GEP_6]], align 2
130 ; CHECK-NEXT: ret void
133 %l.0 = load i8, ptr %ptr
134 %cmp.0 = icmp ugt i8 %l.0, 16383
135 %s.0 = select i1 %cmp.0, i8 %l.0, i8 %x
136 store i8 %s.0, ptr %ptr, align 2
138 %gep.1 = getelementptr inbounds i8, ptr %ptr, i8 1
139 %l.1 = load i8, ptr %gep.1
140 %cmp.1 = icmp ugt i8 %l.1, 16383
141 %s.1 = select i1 %cmp.1, i8 %l.1, i8 %x
142 store i8 %s.1, ptr %gep.1, align 2
144 %gep.2 = getelementptr inbounds i8, ptr %ptr, i8 2
145 %l.2 = load i8, ptr %gep.2
146 %cmp.2 = icmp ugt i8 %l.2, 16383
147 %s.2 = select i1 %cmp.2, i8 %l.2, i8 %x
148 store i8 %s.2, ptr %gep.2, align 2
150 %gep.3 = getelementptr inbounds i8, ptr %ptr, i8 3
151 %l.3 = load i8, ptr %gep.3
152 %cmp.3 = icmp ugt i8 %l.3, 16383
153 %s.3 = select i1 %cmp.3, i8 %l.3, i8 %x
154 store i8 %s.3, ptr %gep.3, align 2
156 %gep.4 = getelementptr inbounds i8, ptr %ptr, i8 4
157 %l.4 = load i8, ptr %gep.4
158 %cmp.4 = icmp ugt i8 %l.4, 16383
159 %s.4 = select i1 %cmp.4, i8 %l.4, i8 %x
160 store i8 %s.4, ptr %gep.4, align 2
162 %gep.5 = getelementptr inbounds i8, ptr %ptr, i8 5
163 %l.5 = load i8, ptr %gep.5
164 %cmp.5 = icmp ugt i8 %l.5, 16383
165 %s.5 = select i1 %cmp.5, i8 %l.5, i8 %x
166 store i8 %s.5, ptr %gep.5, align 2
168 %gep.6 = getelementptr inbounds i8, ptr %ptr, i8 6
169 %l.6 = load i8, ptr %gep.6
170 %cmp.6 = icmp ugt i8 %l.6, 16383
171 %s.6 = select i1 %cmp.6, i8 %l.6, i8 %x
172 store i8 %s.6, ptr %gep.6, align 2
180 define void @select_uniform_ugt_8xi8(ptr %ptr, i8 %x) {
181 ; CHECK-LABEL: @select_uniform_ugt_8xi8(
183 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i8>, ptr [[PTR:%.*]], align 1
184 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <8 x i8> [[TMP0]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
185 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <8 x i8> poison, i8 [[X:%.*]], i32 0
186 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <8 x i8> [[TMP2]], <8 x i8> poison, <8 x i32> zeroinitializer
187 ; CHECK-NEXT: [[TMP4:%.*]] = select <8 x i1> [[TMP1]], <8 x i8> [[TMP0]], <8 x i8> [[TMP3]]
188 ; CHECK-NEXT: store <8 x i8> [[TMP4]], ptr [[PTR]], align 2
189 ; CHECK-NEXT: ret void
192 %l.0 = load i8, ptr %ptr
193 %cmp.0 = icmp ugt i8 %l.0, 16383
194 %s.0 = select i1 %cmp.0, i8 %l.0, i8 %x
195 store i8 %s.0, ptr %ptr, align 2
197 %gep.1 = getelementptr inbounds i8, ptr %ptr, i8 1
198 %l.1 = load i8, ptr %gep.1
199 %cmp.1 = icmp ugt i8 %l.1, 16383
200 %s.1 = select i1 %cmp.1, i8 %l.1, i8 %x
201 store i8 %s.1, ptr %gep.1, align 2
203 %gep.2 = getelementptr inbounds i8, ptr %ptr, i8 2
204 %l.2 = load i8, ptr %gep.2
205 %cmp.2 = icmp ugt i8 %l.2, 16383
206 %s.2 = select i1 %cmp.2, i8 %l.2, i8 %x
207 store i8 %s.2, ptr %gep.2, align 2
209 %gep.3 = getelementptr inbounds i8, ptr %ptr, i8 3
210 %l.3 = load i8, ptr %gep.3
211 %cmp.3 = icmp ugt i8 %l.3, 16383
212 %s.3 = select i1 %cmp.3, i8 %l.3, i8 %x
213 store i8 %s.3, ptr %gep.3, align 2
215 %gep.4 = getelementptr inbounds i8, ptr %ptr, i8 4
216 %l.4 = load i8, ptr %gep.4
217 %cmp.4 = icmp ugt i8 %l.4, 16383
218 %s.4 = select i1 %cmp.4, i8 %l.4, i8 %x
219 store i8 %s.4, ptr %gep.4, align 2
221 %gep.5 = getelementptr inbounds i8, ptr %ptr, i8 5
222 %l.5 = load i8, ptr %gep.5
223 %cmp.5 = icmp ugt i8 %l.5, 16383
224 %s.5 = select i1 %cmp.5, i8 %l.5, i8 %x
225 store i8 %s.5, ptr %gep.5, align 2
227 %gep.6 = getelementptr inbounds i8, ptr %ptr, i8 6
228 %l.6 = load i8, ptr %gep.6
229 %cmp.6 = icmp ugt i8 %l.6, 16383
230 %s.6 = select i1 %cmp.6, i8 %l.6, i8 %x
231 store i8 %s.6, ptr %gep.6, align 2
233 %gep.7 = getelementptr inbounds i8, ptr %ptr, i8 7
234 %l.7 = load i8, ptr %gep.7
235 %cmp.7 = icmp ugt i8 %l.7, 16383
236 %s.7 = select i1 %cmp.7, i8 %l.7, i8 %x
237 store i8 %s.7, ptr %gep.7, align 2
241 define void @select_uniform_ugt_16xi8(ptr %ptr, i8 %x) {
242 ; CHECK-LABEL: @select_uniform_ugt_16xi8(
244 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i8>, ptr [[PTR:%.*]], align 1
245 ; CHECK-NEXT: [[GEP_8:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 8
246 ; CHECK-NEXT: [[L_8:%.*]] = load i8, ptr [[GEP_8]], align 1
247 ; CHECK-NEXT: [[CMP_8:%.*]] = icmp ugt i8 [[L_8]], -1
248 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <8 x i8> [[TMP0]], i32 0
249 ; CHECK-NEXT: [[S_8:%.*]] = select i1 [[CMP_8]], i8 [[TMP1]], i8 [[X:%.*]]
250 ; CHECK-NEXT: [[GEP_9:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 9
251 ; CHECK-NEXT: [[L_9:%.*]] = load i8, ptr [[GEP_9]], align 1
252 ; CHECK-NEXT: [[GEP_10:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 10
253 ; CHECK-NEXT: [[L_10:%.*]] = load i8, ptr [[GEP_10]], align 1
254 ; CHECK-NEXT: [[GEP_11:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 11
255 ; CHECK-NEXT: [[L_11:%.*]] = load i8, ptr [[GEP_11]], align 1
256 ; CHECK-NEXT: [[GEP_12:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i8 12
257 ; CHECK-NEXT: [[TMP2:%.*]] = load <4 x i8>, ptr [[GEP_12]], align 1
258 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <8 x i8> [[TMP0]], <8 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
259 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <16 x i8> [[TMP3]], i8 [[L_9]], i32 9
260 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <16 x i8> [[TMP4]], i8 [[L_10]], i32 10
261 ; CHECK-NEXT: [[TMP6:%.*]] = insertelement <16 x i8> [[TMP5]], i8 [[L_11]], i32 11
262 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <4 x i8> [[TMP2]], <4 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
263 ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <16 x i8> [[TMP6]], <16 x i8> [[TMP7]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 16, i32 17, i32 18, i32 19>
264 ; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <16 x i8> [[TMP8]], <16 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
265 ; CHECK-NEXT: [[TMP10:%.*]] = icmp ugt <16 x i8> [[TMP9]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
266 ; CHECK-NEXT: [[TMP11:%.*]] = insertelement <16 x i8> poison, i8 [[X]], i32 0
267 ; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <16 x i8> [[TMP11]], <16 x i8> poison, <16 x i32> zeroinitializer
268 ; CHECK-NEXT: [[TMP13:%.*]] = select <16 x i1> [[TMP10]], <16 x i8> [[TMP9]], <16 x i8> [[TMP12]]
269 ; CHECK-NEXT: store <16 x i8> [[TMP13]], ptr [[PTR]], align 2
270 ; CHECK-NEXT: ret void
273 %l.0 = load i8, ptr %ptr
274 %cmp.0 = icmp ugt i8 %l.0, 16383
275 %s.0 = select i1 %cmp.0, i8 %l.0, i8 %x
276 store i8 %s.0, ptr %ptr, align 2
278 %gep.1 = getelementptr inbounds i8, ptr %ptr, i8 1
279 %l.1 = load i8, ptr %gep.1
280 %cmp.1 = icmp ugt i8 %l.1, 16383
281 %s.1 = select i1 %cmp.1, i8 %l.1, i8 %x
282 store i8 %s.1, ptr %gep.1, align 2
284 %gep.2 = getelementptr inbounds i8, ptr %ptr, i8 2
285 %l.2 = load i8, ptr %gep.2
286 %cmp.2 = icmp ugt i8 %l.2, 16383
287 %s.2 = select i1 %cmp.2, i8 %l.2, i8 %x
288 store i8 %s.2, ptr %gep.2, align 2
290 %gep.3 = getelementptr inbounds i8, ptr %ptr, i8 3
291 %l.3 = load i8, ptr %gep.3
292 %cmp.3 = icmp ugt i8 %l.3, 16383
293 %s.3 = select i1 %cmp.3, i8 %l.3, i8 %x
294 store i8 %s.3, ptr %gep.3, align 2
296 %gep.4 = getelementptr inbounds i8, ptr %ptr, i8 4
297 %l.4 = load i8, ptr %gep.4
298 %cmp.4 = icmp ugt i8 %l.4, 16383
299 %s.4 = select i1 %cmp.4, i8 %l.4, i8 %x
300 store i8 %s.4, ptr %gep.4, align 2
302 %gep.5 = getelementptr inbounds i8, ptr %ptr, i8 5
303 %l.5 = load i8, ptr %gep.5
304 %cmp.5 = icmp ugt i8 %l.5, 16383
305 %s.5 = select i1 %cmp.5, i8 %l.5, i8 %x
306 store i8 %s.5, ptr %gep.5, align 2
308 %gep.6 = getelementptr inbounds i8, ptr %ptr, i8 6
309 %l.6 = load i8, ptr %gep.6
310 %cmp.6 = icmp ugt i8 %l.6, 16383
311 %s.6 = select i1 %cmp.6, i8 %l.6, i8 %x
312 store i8 %s.6, ptr %gep.6, align 2
314 %gep.7 = getelementptr inbounds i8, ptr %ptr, i8 7
315 %l.7 = load i8, ptr %gep.7
316 %cmp.7 = icmp ugt i8 %l.7, 16383
317 %s.7 = select i1 %cmp.7, i8 %l.7, i8 %x
318 store i8 %s.7, ptr %gep.7, align 2
320 %gep.8 = getelementptr inbounds i8, ptr %ptr, i8 8
321 %l.8 = load i8, ptr %gep.8
322 %cmp.8 = icmp ugt i8 %l.8, 16383
323 %s.8 = select i1 %cmp.8, i8 %l.0, i8 %x
324 store i8 %s.0, ptr %gep.8, align 2
326 %gep.9 = getelementptr inbounds i8, ptr %ptr, i8 9
327 %l.9 = load i8, ptr %gep.9
328 %cmp.9 = icmp ugt i8 %l.9, 16383
329 %s.9 = select i1 %cmp.9, i8 %l.9, i8 %x
330 store i8 %s.9, ptr %gep.9, align 2
332 %gep.10 = getelementptr inbounds i8, ptr %ptr, i8 10
333 %l.10 = load i8, ptr %gep.10
334 %cmp.10 = icmp ugt i8 %l.10, 16383
335 %s.10 = select i1 %cmp.10, i8 %l.10, i8 %x
336 store i8 %s.10, ptr %gep.10, align 2
338 %gep.11 = getelementptr inbounds i8, ptr %ptr, i8 11
339 %l.11 = load i8, ptr %gep.11
340 %cmp.11 = icmp ugt i8 %l.11, 16383
341 %s.11 = select i1 %cmp.11, i8 %l.11, i8 %x
342 store i8 %s.11, ptr %gep.11, align 2
344 %gep.12 = getelementptr inbounds i8, ptr %ptr, i8 12
345 %l.12 = load i8, ptr %gep.12
346 %cmp.12 = icmp ugt i8 %l.12, 16383
347 %s.12 = select i1 %cmp.12, i8 %l.12, i8 %x
348 store i8 %s.12, ptr %gep.12, align 2
350 %gep.13 = getelementptr inbounds i8, ptr %ptr, i8 13
351 %l.13 = load i8, ptr %gep.13
352 %cmp.13 = icmp ugt i8 %l.13, 16383
353 %s.13 = select i1 %cmp.13, i8 %l.13, i8 %x
354 store i8 %s.13, ptr %gep.13, align 2
356 %gep.14 = getelementptr inbounds i8, ptr %ptr, i8 14
357 %l.14 = load i8, ptr %gep.14
358 %cmp.14 = icmp ugt i8 %l.14, 16383
359 %s.14 = select i1 %cmp.14, i8 %l.14, i8 %x
360 store i8 %s.14, ptr %gep.14, align 2
362 %gep.15 = getelementptr inbounds i8, ptr %ptr, i8 15
363 %l.15 = load i8, ptr %gep.15
364 %cmp.15 = icmp ugt i8 %l.15, 16383
365 %s.15 = select i1 %cmp.15, i8 %l.15, i8 %x
366 store i8 %s.15, ptr %gep.15, align 2
372 define void @select_uniform_ugt_4xi16(ptr %ptr, i16 %x) {
373 ; CHECK-LABEL: @select_uniform_ugt_4xi16(
375 ; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i16>, ptr [[PTR:%.*]], align 2
376 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt <4 x i16> [[TMP0]], <i16 16383, i16 16383, i16 16383, i16 16383>
377 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i16> poison, i16 [[X:%.*]], i32 0
378 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i16> [[TMP2]], <4 x i16> poison, <4 x i32> zeroinitializer
379 ; CHECK-NEXT: [[TMP4:%.*]] = select <4 x i1> [[TMP1]], <4 x i16> [[TMP0]], <4 x i16> [[TMP3]]
380 ; CHECK-NEXT: store <4 x i16> [[TMP4]], ptr [[PTR]], align 2
381 ; CHECK-NEXT: ret void
384 %l.0 = load i16, ptr %ptr
385 %cmp.0 = icmp ugt i16 %l.0, 16383
386 %s.0 = select i1 %cmp.0, i16 %l.0, i16 %x
387 store i16 %s.0, ptr %ptr, align 2
389 %gep.1 = getelementptr inbounds i16, ptr %ptr, i16 1
390 %l.1 = load i16, ptr %gep.1
391 %cmp.1 = icmp ugt i16 %l.1, 16383
392 %s.1 = select i1 %cmp.1, i16 %l.1, i16 %x
393 store i16 %s.1, ptr %gep.1, align 2
395 %gep.2 = getelementptr inbounds i16, ptr %ptr, i16 2
396 %l.2 = load i16, ptr %gep.2
397 %cmp.2 = icmp ugt i16 %l.2, 16383
398 %s.2 = select i1 %cmp.2, i16 %l.2, i16 %x
399 store i16 %s.2, ptr %gep.2, align 2
401 %gep.3 = getelementptr inbounds i16, ptr %ptr, i16 3
402 %l.3 = load i16, ptr %gep.3
403 %cmp.3 = icmp ugt i16 %l.3, 16383
404 %s.3 = select i1 %cmp.3, i16 %l.3, i16 %x
405 store i16 %s.3, ptr %gep.3, align 2
410 define void @select_uniform_ult_8xi16(ptr %ptr, i16 %x) {
411 ; CHECK-LABEL: @select_uniform_ult_8xi16(
413 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i16>, ptr [[PTR:%.*]], align 2
414 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult <8 x i16> [[TMP0]], <i16 16383, i16 16383, i16 16383, i16 16383, i16 16383, i16 16383, i16 16383, i16 16383>
415 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <8 x i16> poison, i16 [[X:%.*]], i32 0
416 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x i16> poison, <8 x i32> zeroinitializer
417 ; CHECK-NEXT: [[TMP4:%.*]] = select <8 x i1> [[TMP1]], <8 x i16> [[TMP0]], <8 x i16> [[TMP3]]
418 ; CHECK-NEXT: store <8 x i16> [[TMP4]], ptr [[PTR]], align 2
419 ; CHECK-NEXT: ret void
422 %l.0 = load i16, ptr %ptr
423 %cmp.0 = icmp ult i16 %l.0, 16383
424 %s.0 = select i1 %cmp.0, i16 %l.0, i16 %x
425 store i16 %s.0, ptr %ptr, align 2
427 %gep.1 = getelementptr inbounds i16, ptr %ptr, i16 1
428 %l.1 = load i16, ptr %gep.1
429 %cmp.1 = icmp ult i16 %l.1, 16383
430 %s.1 = select i1 %cmp.1, i16 %l.1, i16 %x
431 store i16 %s.1, ptr %gep.1, align 2
433 %gep.2 = getelementptr inbounds i16, ptr %ptr, i16 2
434 %l.2 = load i16, ptr %gep.2
435 %cmp.2 = icmp ult i16 %l.2, 16383
436 %s.2 = select i1 %cmp.2, i16 %l.2, i16 %x
437 store i16 %s.2, ptr %gep.2, align 2
439 %gep.3 = getelementptr inbounds i16, ptr %ptr, i16 3
440 %l.3 = load i16, ptr %gep.3
441 %cmp.3 = icmp ult i16 %l.3, 16383
442 %s.3 = select i1 %cmp.3, i16 %l.3, i16 %x
443 store i16 %s.3, ptr %gep.3, align 2
445 %gep.4 = getelementptr inbounds i16, ptr %ptr, i16 4
446 %l.4 = load i16, ptr %gep.4
447 %cmp.4 = icmp ult i16 %l.4, 16383
448 %s.4 = select i1 %cmp.4, i16 %l.4, i16 %x
449 store i16 %s.4, ptr %gep.4, align 2
451 %gep.5 = getelementptr inbounds i16, ptr %ptr, i16 5
452 %l.5 = load i16, ptr %gep.5
453 %cmp.5 = icmp ult i16 %l.5, 16383
454 %s.5 = select i1 %cmp.5, i16 %l.5, i16 %x
455 store i16 %s.5, ptr %gep.5, align 2
457 %gep.6 = getelementptr inbounds i16, ptr %ptr, i16 6
458 %l.6 = load i16, ptr %gep.6
459 %cmp.6 = icmp ult i16 %l.6, 16383
460 %s.6 = select i1 %cmp.6, i16 %l.6, i16 %x
461 store i16 %s.6, ptr %gep.6, align 2
463 %gep.7 = getelementptr inbounds i16, ptr %ptr, i16 7
464 %l.7 = load i16, ptr %gep.7
465 %cmp.7 = icmp ult i16 %l.7, 16383
466 %s.7 = select i1 %cmp.7, i16 %l.7, i16 %x
467 store i16 %s.7, ptr %gep.7, align 2
471 define void @select_uniform_eq_2xi32(ptr %ptr, i32 %x) {
472 ; CHECK-LABEL: @select_uniform_eq_2xi32(
474 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[PTR:%.*]], align 4
475 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq <2 x i32> [[TMP0]], <i32 16383, i32 16383>
476 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> poison, i32 [[X:%.*]], i32 0
477 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP2]], <2 x i32> poison, <2 x i32> zeroinitializer
478 ; CHECK-NEXT: [[TMP4:%.*]] = select <2 x i1> [[TMP1]], <2 x i32> [[TMP0]], <2 x i32> [[TMP3]]
479 ; CHECK-NEXT: store <2 x i32> [[TMP4]], ptr [[PTR]], align 2
480 ; CHECK-NEXT: ret void
483 %l.0 = load i32, ptr %ptr
484 %cmp.0 = icmp eq i32 %l.0, 16383
485 %s.0 = select i1 %cmp.0, i32 %l.0, i32 %x
486 store i32 %s.0, ptr %ptr, align 2
488 %gep.1 = getelementptr inbounds i32, ptr %ptr, i32 1
489 %l.1 = load i32, ptr %gep.1
490 %cmp.1 = icmp eq i32 %l.1, 16383
491 %s.1 = select i1 %cmp.1, i32 %l.1, i32 %x
492 store i32 %s.1, ptr %gep.1, align 2
497 define void @select_uniform_eq_4xi32(ptr %ptr, i32 %x) {
498 ; CHECK-LABEL: @select_uniform_eq_4xi32(
500 ; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[PTR:%.*]], align 4
501 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq <4 x i32> [[TMP0]], <i32 16383, i32 16383, i32 16383, i32 16383>
502 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> poison, i32 [[X:%.*]], i32 0
503 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> poison, <4 x i32> zeroinitializer
504 ; CHECK-NEXT: [[TMP4:%.*]] = select <4 x i1> [[TMP1]], <4 x i32> [[TMP0]], <4 x i32> [[TMP3]]
505 ; CHECK-NEXT: store <4 x i32> [[TMP4]], ptr [[PTR]], align 2
506 ; CHECK-NEXT: ret void
509 %l.0 = load i32, ptr %ptr
510 %cmp.0 = icmp eq i32 %l.0, 16383
511 %s.0 = select i1 %cmp.0, i32 %l.0, i32 %x
512 store i32 %s.0, ptr %ptr, align 2
514 %gep.1 = getelementptr inbounds i32, ptr %ptr, i32 1
515 %l.1 = load i32, ptr %gep.1
516 %cmp.1 = icmp eq i32 %l.1, 16383
517 %s.1 = select i1 %cmp.1, i32 %l.1, i32 %x
518 store i32 %s.1, ptr %gep.1, align 2
520 %gep.2 = getelementptr inbounds i32, ptr %ptr, i32 2
521 %l.2 = load i32, ptr %gep.2
522 %cmp.2 = icmp eq i32 %l.2, 16383
523 %s.2 = select i1 %cmp.2, i32 %l.2, i32 %x
524 store i32 %s.2, ptr %gep.2, align 2
526 %gep.3 = getelementptr inbounds i32, ptr %ptr, i32 3
527 %l.3 = load i32, ptr %gep.3
528 %cmp.3 = icmp eq i32 %l.3, 16383
529 %s.3 = select i1 %cmp.3, i32 %l.3, i32 %x
530 store i32 %s.3, ptr %gep.3, align 2
534 define void @select_uniform_ne_2xi64(ptr %ptr, i64 %x) {
535 ; CHECK-LABEL: @select_uniform_ne_2xi64(
537 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[PTR:%.*]], align 8
538 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <2 x i64> [[TMP0]], <i64 16383, i64 16383>
539 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i64> poison, i64 [[X:%.*]], i32 0
540 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> poison, <2 x i32> zeroinitializer
541 ; CHECK-NEXT: [[TMP4:%.*]] = select <2 x i1> [[TMP1]], <2 x i64> [[TMP0]], <2 x i64> [[TMP3]]
542 ; CHECK-NEXT: store <2 x i64> [[TMP4]], ptr [[PTR]], align 2
543 ; CHECK-NEXT: ret void
546 %l.0 = load i64, ptr %ptr
547 %cmp.0 = icmp ne i64 %l.0, 16383
548 %s.0 = select i1 %cmp.0, i64 %l.0, i64 %x
549 store i64 %s.0, ptr %ptr, align 2
551 %gep.1 = getelementptr inbounds i64, ptr %ptr, i64 1
552 %l.1 = load i64, ptr %gep.1
553 %cmp.1 = icmp ne i64 %l.1, 16383
554 %s.1 = select i1 %cmp.1, i64 %l.1, i64 %x
555 store i64 %s.1, ptr %gep.1, align 2