1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -instcombine %s | FileCheck %s
4 define <2 x i8> @add_constant(i8 %x) {
5 ; CHECK-LABEL: @add_constant(
6 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
7 ; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 42, i8 undef>
8 ; CHECK-NEXT: ret <2 x i8> [[BO]]
10 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
11 %bo = add <2 x i8> %ins, <i8 42, i8 undef>
15 define <2 x i8> @add_constant_not_undef_lane(i8 %x) {
16 ; CHECK-LABEL: @add_constant_not_undef_lane(
17 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
18 ; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 42, i8 -42>
19 ; CHECK-NEXT: ret <2 x i8> [[BO]]
21 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
22 %bo = add <2 x i8> %ins, <i8 42, i8 -42>
26 ; IR flags are not required, but they should propagate.
28 define <2 x i8> @sub_constant_op0(i8 %x) {
29 ; CHECK-LABEL: @sub_constant_op0(
30 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
31 ; CHECK-NEXT: [[BO:%.*]] = sub nuw nsw <2 x i8> <i8 undef, i8 -42>, [[INS]]
32 ; CHECK-NEXT: ret <2 x i8> [[BO]]
34 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
35 %bo = sub nsw nuw <2 x i8> <i8 undef, i8 -42>, %ins
39 define <2 x i8> @sub_constant_op0_not_undef_lane(i8 %x) {
40 ; CHECK-LABEL: @sub_constant_op0_not_undef_lane(
41 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
42 ; CHECK-NEXT: [[BO:%.*]] = sub nuw <2 x i8> <i8 42, i8 -42>, [[INS]]
43 ; CHECK-NEXT: ret <2 x i8> [[BO]]
45 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
46 %bo = sub nuw <2 x i8> <i8 42, i8 -42>, %ins
50 define <2 x i8> @sub_constant_op1(i8 %x) {
51 ; CHECK-LABEL: @sub_constant_op1(
52 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
53 ; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 -42, i8 undef>
54 ; CHECK-NEXT: ret <2 x i8> [[BO]]
56 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
57 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 undef>
61 define <2 x i8> @sub_constant_op1_not_undef_lane(i8 %x) {
62 ; CHECK-LABEL: @sub_constant_op1_not_undef_lane(
63 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
64 ; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 -42, i8 42>
65 ; CHECK-NEXT: ret <2 x i8> [[BO]]
67 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
68 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 -42>
72 define <3 x i8> @mul_constant(i8 %x) {
73 ; CHECK-LABEL: @mul_constant(
74 ; CHECK-NEXT: [[INS:%.*]] = insertelement <3 x i8> undef, i8 [[X:%.*]], i32 2
75 ; CHECK-NEXT: [[BO:%.*]] = mul <3 x i8> [[INS]], <i8 undef, i8 undef, i8 -42>
76 ; CHECK-NEXT: ret <3 x i8> [[BO]]
78 %ins = insertelement <3 x i8> undef, i8 %x, i32 2
79 %bo = mul <3 x i8> %ins, <i8 undef, i8 undef, i8 -42>
83 define <3 x i8> @mul_constant_not_undef_lane(i8 %x) {
84 ; CHECK-LABEL: @mul_constant_not_undef_lane(
85 ; CHECK-NEXT: [[INS:%.*]] = insertelement <3 x i8> undef, i8 [[X:%.*]], i32 2
86 ; CHECK-NEXT: [[BO:%.*]] = mul <3 x i8> [[INS]], <i8 42, i8 undef, i8 -42>
87 ; CHECK-NEXT: ret <3 x i8> [[BO]]
89 %ins = insertelement <3 x i8> undef, i8 %x, i32 2
90 %bo = mul <3 x i8> %ins, <i8 42, i8 undef, i8 -42>
94 define <2 x i8> @shl_constant_op0(i8 %x) {
95 ; CHECK-LABEL: @shl_constant_op0(
96 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
97 ; CHECK-NEXT: [[BO:%.*]] = shl <2 x i8> <i8 undef, i8 2>, [[INS]]
98 ; CHECK-NEXT: ret <2 x i8> [[BO]]
100 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
101 %bo = shl <2 x i8> <i8 undef, i8 2>, %ins
105 define <2 x i8> @shl_constant_op0_not_undef_lane(i8 %x) {
106 ; CHECK-LABEL: @shl_constant_op0_not_undef_lane(
107 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
108 ; CHECK-NEXT: [[BO:%.*]] = shl <2 x i8> <i8 5, i8 2>, [[INS]]
109 ; CHECK-NEXT: ret <2 x i8> [[BO]]
111 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
112 %bo = shl <2 x i8> <i8 5, i8 2>, %ins
116 define <2 x i8> @shl_constant_op1(i8 %x) {
117 ; CHECK-LABEL: @shl_constant_op1(
118 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
119 ; CHECK-NEXT: [[BO:%.*]] = shl nuw <2 x i8> [[INS]], <i8 5, i8 undef>
120 ; CHECK-NEXT: ret <2 x i8> [[BO]]
122 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
123 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 undef>
127 define <2 x i8> @shl_constant_op1_not_undef_lane(i8 %x) {
128 ; CHECK-LABEL: @shl_constant_op1_not_undef_lane(
129 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
130 ; CHECK-NEXT: [[BO:%.*]] = shl nuw <2 x i8> [[INS]], <i8 5, i8 2>
131 ; CHECK-NEXT: ret <2 x i8> [[BO]]
133 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
134 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 2>
138 define <2 x i8> @ashr_constant_op0(i8 %x) {
139 ; CHECK-LABEL: @ashr_constant_op0(
140 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
141 ; CHECK-NEXT: [[BO:%.*]] = ashr exact <2 x i8> <i8 undef, i8 2>, [[INS]]
142 ; CHECK-NEXT: ret <2 x i8> [[BO]]
144 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
145 %bo = ashr exact <2 x i8> <i8 undef, i8 2>, %ins
149 define <2 x i8> @ashr_constant_op0_not_undef_lane(i8 %x) {
150 ; CHECK-LABEL: @ashr_constant_op0_not_undef_lane(
151 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
152 ; CHECK-NEXT: [[BO:%.*]] = lshr <2 x i8> <i8 5, i8 2>, [[INS]]
153 ; CHECK-NEXT: ret <2 x i8> [[BO]]
155 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
156 %bo = ashr exact <2 x i8> <i8 5, i8 2>, %ins
160 define <2 x i8> @ashr_constant_op1(i8 %x) {
161 ; CHECK-LABEL: @ashr_constant_op1(
162 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
163 ; CHECK-NEXT: [[BO:%.*]] = ashr <2 x i8> [[INS]], <i8 5, i8 undef>
164 ; CHECK-NEXT: ret <2 x i8> [[BO]]
166 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
167 %bo = ashr <2 x i8> %ins, <i8 5, i8 undef>
171 define <2 x i8> @ashr_constant_op1_not_undef_lane(i8 %x) {
172 ; CHECK-LABEL: @ashr_constant_op1_not_undef_lane(
173 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
174 ; CHECK-NEXT: [[BO:%.*]] = ashr <2 x i8> [[INS]], <i8 5, i8 2>
175 ; CHECK-NEXT: ret <2 x i8> [[BO]]
177 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
178 %bo = ashr <2 x i8> %ins, <i8 5, i8 2>
182 define <2 x i8> @lshr_constant_op0(i8 %x) {
183 ; CHECK-LABEL: @lshr_constant_op0(
184 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
185 ; CHECK-NEXT: [[BO:%.*]] = lshr <2 x i8> <i8 5, i8 undef>, [[INS]]
186 ; CHECK-NEXT: ret <2 x i8> [[BO]]
188 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
189 %bo = lshr <2 x i8> <i8 5, i8 undef>, %ins
193 define <2 x i8> @lshr_constant_op0_not_undef_lane(i8 %x) {
194 ; CHECK-LABEL: @lshr_constant_op0_not_undef_lane(
195 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
196 ; CHECK-NEXT: [[BO:%.*]] = lshr <2 x i8> <i8 5, i8 2>, [[INS]]
197 ; CHECK-NEXT: ret <2 x i8> [[BO]]
199 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
200 %bo = lshr <2 x i8> <i8 5, i8 2>, %ins
204 define <2 x i8> @lshr_constant_op1(i8 %x) {
205 ; CHECK-LABEL: @lshr_constant_op1(
206 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
207 ; CHECK-NEXT: [[BO:%.*]] = lshr exact <2 x i8> [[INS]], <i8 undef, i8 2>
208 ; CHECK-NEXT: ret <2 x i8> [[BO]]
210 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
211 %bo = lshr exact <2 x i8> %ins, <i8 undef, i8 2>
215 define <2 x i8> @lshr_constant_op1_not_undef_lane(i8 %x) {
216 ; CHECK-LABEL: @lshr_constant_op1_not_undef_lane(
217 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
218 ; CHECK-NEXT: [[BO:%.*]] = lshr exact <2 x i8> [[INS]], <i8 5, i8 2>
219 ; CHECK-NEXT: ret <2 x i8> [[BO]]
221 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
222 %bo = lshr exact <2 x i8> %ins, <i8 5, i8 2>
226 define <2 x i8> @urem_constant_op0(i8 %x) {
227 ; CHECK-LABEL: @urem_constant_op0(
228 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
229 ; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> <i8 5, i8 undef>, [[INS]]
230 ; CHECK-NEXT: ret <2 x i8> [[BO]]
232 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
233 %bo = urem <2 x i8> <i8 5, i8 undef>, %ins
237 define <2 x i8> @urem_constant_op0_not_undef_lane(i8 %x) {
238 ; CHECK-LABEL: @urem_constant_op0_not_undef_lane(
239 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
240 ; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> <i8 5, i8 2>, [[INS]]
241 ; CHECK-NEXT: ret <2 x i8> [[BO]]
243 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
244 %bo = urem <2 x i8> <i8 5, i8 2>, %ins
248 define <2 x i8> @urem_constant_op1(i8 %x) {
249 ; CHECK-LABEL: @urem_constant_op1(
250 ; CHECK-NEXT: ret <2 x i8> poison
252 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
253 %bo = urem <2 x i8> %ins, <i8 undef, i8 2>
257 define <2 x i8> @urem_constant_op1_not_undef_lane(i8 %x) {
258 ; CHECK-LABEL: @urem_constant_op1_not_undef_lane(
259 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
260 ; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> [[INS]], <i8 5, i8 2>
261 ; CHECK-NEXT: ret <2 x i8> [[BO]]
263 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
264 %bo = urem <2 x i8> %ins, <i8 5, i8 2>
268 define <2 x i8> @srem_constant_op0(i8 %x) {
269 ; CHECK-LABEL: @srem_constant_op0(
270 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
271 ; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> <i8 5, i8 undef>, [[INS]]
272 ; CHECK-NEXT: ret <2 x i8> [[BO]]
274 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
275 %bo = srem <2 x i8> <i8 5, i8 undef>, %ins
279 define <2 x i8> @srem_constant_op0_not_undef_lane(i8 %x) {
280 ; CHECK-LABEL: @srem_constant_op0_not_undef_lane(
281 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
282 ; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> <i8 5, i8 2>, [[INS]]
283 ; CHECK-NEXT: ret <2 x i8> [[BO]]
285 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
286 %bo = srem <2 x i8> <i8 5, i8 2>, %ins
290 define <2 x i8> @srem_constant_op1(i8 %x) {
291 ; CHECK-LABEL: @srem_constant_op1(
292 ; CHECK-NEXT: ret <2 x i8> poison
294 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
295 %bo = srem <2 x i8> %ins, <i8 undef, i8 2>
299 define <2 x i8> @srem_constant_op1_not_undef_lane(i8 %x) {
300 ; CHECK-LABEL: @srem_constant_op1_not_undef_lane(
301 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
302 ; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> [[INS]], <i8 5, i8 2>
303 ; CHECK-NEXT: ret <2 x i8> [[BO]]
305 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
306 %bo = srem <2 x i8> %ins, <i8 5, i8 2>
310 define <2 x i8> @udiv_constant_op0(i8 %x) {
311 ; CHECK-LABEL: @udiv_constant_op0(
312 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
313 ; CHECK-NEXT: [[BO:%.*]] = udiv exact <2 x i8> <i8 5, i8 undef>, [[INS]]
314 ; CHECK-NEXT: ret <2 x i8> [[BO]]
316 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
317 %bo = udiv exact <2 x i8> <i8 5, i8 undef>, %ins
321 define <2 x i8> @udiv_constant_op0_not_undef_lane(i8 %x) {
322 ; CHECK-LABEL: @udiv_constant_op0_not_undef_lane(
323 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
324 ; CHECK-NEXT: [[BO:%.*]] = udiv exact <2 x i8> <i8 5, i8 2>, [[INS]]
325 ; CHECK-NEXT: ret <2 x i8> [[BO]]
327 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
328 %bo = udiv exact <2 x i8> <i8 5, i8 2>, %ins
332 define <2 x i8> @udiv_constant_op1(i8 %x) {
333 ; CHECK-LABEL: @udiv_constant_op1(
334 ; CHECK-NEXT: ret <2 x i8> poison
336 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
337 %bo = udiv <2 x i8> %ins, <i8 undef, i8 2>
341 define <2 x i8> @udiv_constant_op1_not_undef_lane(i8 %x) {
342 ; CHECK-LABEL: @udiv_constant_op1_not_undef_lane(
343 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
344 ; CHECK-NEXT: [[BO:%.*]] = udiv <2 x i8> [[INS]], <i8 5, i8 2>
345 ; CHECK-NEXT: ret <2 x i8> [[BO]]
347 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
348 %bo = udiv <2 x i8> %ins, <i8 5, i8 2>
352 define <2 x i8> @sdiv_constant_op0(i8 %x) {
353 ; CHECK-LABEL: @sdiv_constant_op0(
354 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
355 ; CHECK-NEXT: [[BO:%.*]] = sdiv <2 x i8> <i8 5, i8 undef>, [[INS]]
356 ; CHECK-NEXT: ret <2 x i8> [[BO]]
358 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
359 %bo = sdiv <2 x i8> <i8 5, i8 undef>, %ins
363 define <2 x i8> @sdiv_constant_op0_not_undef_lane(i8 %x) {
364 ; CHECK-LABEL: @sdiv_constant_op0_not_undef_lane(
365 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
366 ; CHECK-NEXT: [[BO:%.*]] = sdiv <2 x i8> <i8 5, i8 2>, [[INS]]
367 ; CHECK-NEXT: ret <2 x i8> [[BO]]
369 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
370 %bo = sdiv <2 x i8> <i8 5, i8 2>, %ins
374 define <2 x i8> @sdiv_constant_op1(i8 %x) {
375 ; CHECK-LABEL: @sdiv_constant_op1(
376 ; CHECK-NEXT: ret <2 x i8> poison
378 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
379 %bo = sdiv exact <2 x i8> %ins, <i8 undef, i8 2>
383 define <2 x i8> @sdiv_constant_op1_not_undef_lane(i8 %x) {
384 ; CHECK-LABEL: @sdiv_constant_op1_not_undef_lane(
385 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
386 ; CHECK-NEXT: [[BO:%.*]] = sdiv exact <2 x i8> [[INS]], <i8 5, i8 2>
387 ; CHECK-NEXT: ret <2 x i8> [[BO]]
389 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
390 %bo = sdiv exact <2 x i8> %ins, <i8 5, i8 2>
394 define <2 x i8> @and_constant(i8 %x) {
395 ; CHECK-LABEL: @and_constant(
396 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
397 ; CHECK-NEXT: [[BO:%.*]] = and <2 x i8> [[INS]], <i8 42, i8 undef>
398 ; CHECK-NEXT: ret <2 x i8> [[BO]]
400 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
401 %bo = and <2 x i8> %ins, <i8 42, i8 undef>
405 define <2 x i8> @and_constant_not_undef_lane(i8 %x) {
406 ; CHECK-LABEL: @and_constant_not_undef_lane(
407 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
408 ; CHECK-NEXT: [[BO:%.*]] = and <2 x i8> [[INS]], <i8 42, i8 -42>
409 ; CHECK-NEXT: ret <2 x i8> [[BO]]
411 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
412 %bo = and <2 x i8> %ins, <i8 42, i8 -42>
416 define <2 x i8> @or_constant(i8 %x) {
417 ; CHECK-LABEL: @or_constant(
418 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
419 ; CHECK-NEXT: [[BO:%.*]] = or <2 x i8> [[INS]], <i8 undef, i8 -42>
420 ; CHECK-NEXT: ret <2 x i8> [[BO]]
422 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
423 %bo = or <2 x i8> %ins, <i8 undef, i8 -42>
427 define <2 x i8> @or_constant_not_undef_lane(i8 %x) {
428 ; CHECK-LABEL: @or_constant_not_undef_lane(
429 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1
430 ; CHECK-NEXT: [[BO:%.*]] = or <2 x i8> [[INS]], <i8 42, i8 -42>
431 ; CHECK-NEXT: ret <2 x i8> [[BO]]
433 %ins = insertelement <2 x i8> undef, i8 %x, i32 1
434 %bo = or <2 x i8> %ins, <i8 42, i8 -42>
438 define <2 x i8> @xor_constant(i8 %x) {
439 ; CHECK-LABEL: @xor_constant(
440 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
441 ; CHECK-NEXT: [[BO:%.*]] = xor <2 x i8> [[INS]], <i8 42, i8 undef>
442 ; CHECK-NEXT: ret <2 x i8> [[BO]]
444 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
445 %bo = xor <2 x i8> %ins, <i8 42, i8 undef>
449 define <2 x i8> @xor_constant_not_undef_lane(i8 %x) {
450 ; CHECK-LABEL: @xor_constant_not_undef_lane(
451 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0
452 ; CHECK-NEXT: [[BO:%.*]] = xor <2 x i8> [[INS]], <i8 42, i8 -42>
453 ; CHECK-NEXT: ret <2 x i8> [[BO]]
455 %ins = insertelement <2 x i8> undef, i8 %x, i32 0
456 %bo = xor <2 x i8> %ins, <i8 42, i8 -42>
460 define <2 x float> @fadd_constant(float %x) {
461 ; CHECK-LABEL: @fadd_constant(
462 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
463 ; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float 4.200000e+01, float undef>
464 ; CHECK-NEXT: ret <2 x float> [[BO]]
466 %ins = insertelement <2 x float> undef, float %x, i32 0
467 %bo = fadd <2 x float> %ins, <float 42.0, float undef>
471 define <2 x float> @fadd_constant_not_undef_lane(float %x) {
472 ; CHECK-LABEL: @fadd_constant_not_undef_lane(
473 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
474 ; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>
475 ; CHECK-NEXT: ret <2 x float> [[BO]]
477 %ins = insertelement <2 x float> undef, float %x, i32 1
478 %bo = fadd <2 x float> %ins, <float 42.0, float -42.0>
482 define <2 x float> @fsub_constant_op0(float %x) {
483 ; CHECK-LABEL: @fsub_constant_op0(
484 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
485 ; CHECK-NEXT: [[BO:%.*]] = fsub fast <2 x float> <float 4.200000e+01, float undef>, [[INS]]
486 ; CHECK-NEXT: ret <2 x float> [[BO]]
488 %ins = insertelement <2 x float> undef, float %x, i32 0
489 %bo = fsub fast <2 x float> <float 42.0, float undef>, %ins
493 define <2 x float> @fsub_constant_op0_not_undef_lane(float %x) {
494 ; CHECK-LABEL: @fsub_constant_op0_not_undef_lane(
495 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
496 ; CHECK-NEXT: [[BO:%.*]] = fsub nsz <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]
497 ; CHECK-NEXT: ret <2 x float> [[BO]]
499 %ins = insertelement <2 x float> undef, float %x, i32 1
500 %bo = fsub nsz <2 x float> <float 42.0, float -42.0>, %ins
504 define <2 x float> @fsub_constant_op1(float %x) {
505 ; CHECK-LABEL: @fsub_constant_op1(
506 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
507 ; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float undef, float -4.200000e+01>
508 ; CHECK-NEXT: ret <2 x float> [[BO]]
510 %ins = insertelement <2 x float> undef, float %x, i32 1
511 %bo = fsub <2 x float> %ins, <float undef, float 42.0>
515 define <2 x float> @fsub_constant_op1_not_undef_lane(float %x) {
516 ; CHECK-LABEL: @fsub_constant_op1_not_undef_lane(
517 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
518 ; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float -4.200000e+01, float 4.200000e+01>
519 ; CHECK-NEXT: ret <2 x float> [[BO]]
521 %ins = insertelement <2 x float> undef, float %x, i32 0
522 %bo = fsub <2 x float> %ins, <float 42.0, float -42.0>
526 define <2 x float> @fmul_constant(float %x) {
527 ; CHECK-LABEL: @fmul_constant(
528 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
529 ; CHECK-NEXT: [[BO:%.*]] = fmul reassoc <2 x float> [[INS]], <float 4.200000e+01, float undef>
530 ; CHECK-NEXT: ret <2 x float> [[BO]]
532 %ins = insertelement <2 x float> undef, float %x, i32 0
533 %bo = fmul reassoc <2 x float> %ins, <float 42.0, float undef>
537 define <2 x float> @fmul_constant_not_undef_lane(float %x) {
538 ; CHECK-LABEL: @fmul_constant_not_undef_lane(
539 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
540 ; CHECK-NEXT: [[BO:%.*]] = fmul <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>
541 ; CHECK-NEXT: ret <2 x float> [[BO]]
543 %ins = insertelement <2 x float> undef, float %x, i32 1
544 %bo = fmul <2 x float> %ins, <float 42.0, float -42.0>
548 define <2 x float> @fdiv_constant_op0(float %x) {
549 ; CHECK-LABEL: @fdiv_constant_op0(
550 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
551 ; CHECK-NEXT: [[BO:%.*]] = fdiv nnan <2 x float> <float undef, float 4.200000e+01>, [[INS]]
552 ; CHECK-NEXT: ret <2 x float> [[BO]]
554 %ins = insertelement <2 x float> undef, float %x, i32 1
555 %bo = fdiv nnan <2 x float> <float undef, float 42.0>, %ins
559 define <2 x float> @fdiv_constant_op0_not_undef_lane(float %x) {
560 ; CHECK-LABEL: @fdiv_constant_op0_not_undef_lane(
561 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
562 ; CHECK-NEXT: [[BO:%.*]] = fdiv ninf <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]
563 ; CHECK-NEXT: ret <2 x float> [[BO]]
565 %ins = insertelement <2 x float> undef, float %x, i32 0
566 %bo = fdiv ninf <2 x float> <float 42.0, float -42.0>, %ins
570 define <2 x float> @fdiv_constant_op1(float %x) {
571 ; CHECK-LABEL: @fdiv_constant_op1(
572 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
573 ; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[INS]], <float 4.200000e+01, float undef>
574 ; CHECK-NEXT: ret <2 x float> [[BO]]
576 %ins = insertelement <2 x float> undef, float %x, i32 0
577 %bo = fdiv <2 x float> %ins, <float 42.0, float undef>
581 define <2 x float> @fdiv_constant_op1_not_undef_lane(float %x) {
582 ; CHECK-LABEL: @fdiv_constant_op1_not_undef_lane(
583 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
584 ; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>
585 ; CHECK-NEXT: ret <2 x float> [[BO]]
587 %ins = insertelement <2 x float> undef, float %x, i32 0
588 %bo = fdiv <2 x float> %ins, <float 42.0, float -42.0>
592 define <2 x float> @frem_constant_op0(float %x) {
593 ; CHECK-LABEL: @frem_constant_op0(
594 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
595 ; CHECK-NEXT: [[BO:%.*]] = frem fast <2 x float> <float 4.200000e+01, float undef>, [[INS]]
596 ; CHECK-NEXT: ret <2 x float> [[BO]]
598 %ins = insertelement <2 x float> undef, float %x, i32 0
599 %bo = frem fast <2 x float> <float 42.0, float undef>, %ins
603 define <2 x float> @frem_constant_op0_not_undef_lane(float %x) {
604 ; CHECK-LABEL: @frem_constant_op0_not_undef_lane(
605 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
606 ; CHECK-NEXT: [[BO:%.*]] = frem <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]
607 ; CHECK-NEXT: ret <2 x float> [[BO]]
609 %ins = insertelement <2 x float> undef, float %x, i32 1
610 %bo = frem <2 x float> <float 42.0, float -42.0>, %ins
614 define <2 x float> @frem_constant_op1(float %x) {
615 ; CHECK-LABEL: @frem_constant_op1(
616 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
617 ; CHECK-NEXT: [[BO:%.*]] = frem ninf <2 x float> [[INS]], <float undef, float 4.200000e+01>
618 ; CHECK-NEXT: ret <2 x float> [[BO]]
620 %ins = insertelement <2 x float> undef, float %x, i32 1
621 %bo = frem ninf <2 x float> %ins, <float undef, float 42.0>
625 define <2 x float> @frem_constant_op1_not_undef_lane(float %x) {
626 ; CHECK-LABEL: @frem_constant_op1_not_undef_lane(
627 ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0
628 ; CHECK-NEXT: [[BO:%.*]] = frem nnan <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>
629 ; CHECK-NEXT: ret <2 x float> [[BO]]
631 %ins = insertelement <2 x float> undef, float %x, i32 0
632 %bo = frem nnan <2 x float> %ins, <float 42.0, float -42.0>