@@ -170,3 +170,221 @@ define <2 x i8> @test_ssub_vector_sat_neg(<2 x i8> %a) {
170
170
%x = call <2 x i8 > @llvm.ssub.sat.v2i8 (<2 x i8 > <i8 -100 , i8 -10 >, <2 x i8 > <i8 30 , i8 120 >)
171
171
ret <2 x i8 > %x
172
172
}
173
+
174
+ ; Tests for undef handling
175
+
176
+ define i8 @test_uadd_scalar_both_undef () {
177
+ ; CHECK-LABEL: @test_uadd_scalar_both_undef(
178
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 undef, i8 undef)
179
+ ; CHECK-NEXT: ret i8 [[X]]
180
+ ;
181
+ %x = call i8 @llvm.uadd.sat.i8 (i8 undef , i8 undef )
182
+ ret i8 %x
183
+ }
184
+
185
+ define i8 @test_sadd_scalar_both_undef () {
186
+ ; CHECK-LABEL: @test_sadd_scalar_both_undef(
187
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef)
188
+ ; CHECK-NEXT: ret i8 [[X]]
189
+ ;
190
+ %x = call i8 @llvm.sadd.sat.i8 (i8 undef , i8 undef )
191
+ ret i8 %x
192
+ }
193
+
194
+ define i8 @test_usub_scalar_both_undef () {
195
+ ; CHECK-LABEL: @test_usub_scalar_both_undef(
196
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 undef)
197
+ ; CHECK-NEXT: ret i8 [[X]]
198
+ ;
199
+ %x = call i8 @llvm.usub.sat.i8 (i8 undef , i8 undef )
200
+ ret i8 %x
201
+ }
202
+
203
+ define i8 @test_ssub_scalar_both_undef () {
204
+ ; CHECK-LABEL: @test_ssub_scalar_both_undef(
205
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.ssub.sat.i8(i8 undef, i8 undef)
206
+ ; CHECK-NEXT: ret i8 [[X]]
207
+ ;
208
+ %x = call i8 @llvm.ssub.sat.i8 (i8 undef , i8 undef )
209
+ ret i8 %x
210
+ }
211
+
212
+ define i8 @test_uadd_scalar_op2_undef () {
213
+ ; CHECK-LABEL: @test_uadd_scalar_op2_undef(
214
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 10, i8 undef)
215
+ ; CHECK-NEXT: ret i8 [[X]]
216
+ ;
217
+ %x = call i8 @llvm.uadd.sat.i8 (i8 10 , i8 undef )
218
+ ret i8 %x
219
+ }
220
+
221
+ define i8 @test_sadd_scalar_op1_undef () {
222
+ ; CHECK-LABEL: @test_sadd_scalar_op1_undef(
223
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 10)
224
+ ; CHECK-NEXT: ret i8 [[X]]
225
+ ;
226
+ %x = call i8 @llvm.sadd.sat.i8 (i8 undef , i8 10 )
227
+ ret i8 %x
228
+ }
229
+
230
+ define i8 @test_usub_scalar_op2_undef () {
231
+ ; CHECK-LABEL: @test_usub_scalar_op2_undef(
232
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 10, i8 undef)
233
+ ; CHECK-NEXT: ret i8 [[X]]
234
+ ;
235
+ %x = call i8 @llvm.usub.sat.i8 (i8 10 , i8 undef )
236
+ ret i8 %x
237
+ }
238
+
239
+ define i8 @test_usub_scalar_op1_undef () {
240
+ ; CHECK-LABEL: @test_usub_scalar_op1_undef(
241
+ ; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 10)
242
+ ; CHECK-NEXT: ret i8 [[X]]
243
+ ;
244
+ %x = call i8 @llvm.usub.sat.i8 (i8 undef , i8 10 )
245
+ ret i8 %x
246
+ }
247
+
248
+ define <2 x i8 > @test_uadd_vector_both_undef_splat () {
249
+ ; CHECK-LABEL: @test_uadd_vector_both_undef_splat(
250
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
251
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
252
+ ;
253
+ %x = call <2 x i8 > @llvm.uadd.sat.v2i8 (<2 x i8 > undef , <2 x i8 > undef )
254
+ ret <2 x i8 > %x
255
+ }
256
+
257
+ define <2 x i8 > @test_sadd_vector_both_undef_splat () {
258
+ ; CHECK-LABEL: @test_sadd_vector_both_undef_splat(
259
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
260
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
261
+ ;
262
+ %x = call <2 x i8 > @llvm.sadd.sat.v2i8 (<2 x i8 > undef , <2 x i8 > undef )
263
+ ret <2 x i8 > %x
264
+ }
265
+
266
+ define <2 x i8 > @test_usub_vector_both_undef_splat () {
267
+ ; CHECK-LABEL: @test_usub_vector_both_undef_splat(
268
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
269
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
270
+ ;
271
+ %x = call <2 x i8 > @llvm.usub.sat.v2i8 (<2 x i8 > undef , <2 x i8 > undef )
272
+ ret <2 x i8 > %x
273
+ }
274
+
275
+ define <2 x i8 > @test_ssub_vector_both_undef_splat () {
276
+ ; CHECK-LABEL: @test_ssub_vector_both_undef_splat(
277
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> undef)
278
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
279
+ ;
280
+ %x = call <2 x i8 > @llvm.ssub.sat.v2i8 (<2 x i8 > undef , <2 x i8 > undef )
281
+ ret <2 x i8 > %x
282
+ }
283
+
284
+ define <2 x i8 > @test_uadd_vector_op2_undef_splat () {
285
+ ; CHECK-LABEL: @test_uadd_vector_op2_undef_splat(
286
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
287
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
288
+ ;
289
+ %x = call <2 x i8 > @llvm.uadd.sat.v2i8 (<2 x i8 > <i8 10 , i8 20 >, <2 x i8 > undef )
290
+ ret <2 x i8 > %x
291
+ }
292
+
293
+ define <2 x i8 > @test_sadd_vector_op1_undef_splat () {
294
+ ; CHECK-LABEL: @test_sadd_vector_op1_undef_splat(
295
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
296
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
297
+ ;
298
+ %x = call <2 x i8 > @llvm.sadd.sat.v2i8 (<2 x i8 > undef , <2 x i8 > <i8 10 , i8 20 >)
299
+ ret <2 x i8 > %x
300
+ }
301
+
302
+ define <2 x i8 > @test_usub_vector_op2_undef_splat () {
303
+ ; CHECK-LABEL: @test_usub_vector_op2_undef_splat(
304
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef)
305
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
306
+ ;
307
+ %x = call <2 x i8 > @llvm.usub.sat.v2i8 (<2 x i8 > <i8 10 , i8 20 >, <2 x i8 > undef )
308
+ ret <2 x i8 > %x
309
+ }
310
+
311
+ define <2 x i8 > @test_ssub_vector_op1_undef_splat () {
312
+ ; CHECK-LABEL: @test_ssub_vector_op1_undef_splat(
313
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>)
314
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
315
+ ;
316
+ %x = call <2 x i8 > @llvm.ssub.sat.v2i8 (<2 x i8 > undef , <2 x i8 > <i8 10 , i8 20 >)
317
+ ret <2 x i8 > %x
318
+ }
319
+
320
+ define <2 x i8 > @test_uadd_vector_op2_undef_mix1 () {
321
+ ; CHECK-LABEL: @test_uadd_vector_op2_undef_mix1(
322
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
323
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
324
+ ;
325
+ %x = call <2 x i8 > @llvm.uadd.sat.v2i8 (<2 x i8 > <i8 10 , i8 undef >, <2 x i8 > <i8 20 , i8 undef >)
326
+ ret <2 x i8 > %x
327
+ }
328
+
329
+ define <2 x i8 > @test_uadd_vector_op2_undef_mix2 () {
330
+ ; CHECK-LABEL: @test_uadd_vector_op2_undef_mix2(
331
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
332
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
333
+ ;
334
+ %x = call <2 x i8 > @llvm.uadd.sat.v2i8 (<2 x i8 > <i8 10 , i8 undef >, <2 x i8 > <i8 undef , i8 20 >)
335
+ ret <2 x i8 > %x
336
+ }
337
+
338
+ define <2 x i8 > @test_sadd_vector_op1_undef_mix1 () {
339
+ ; CHECK-LABEL: @test_sadd_vector_op1_undef_mix1(
340
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
341
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
342
+ ;
343
+ %x = call <2 x i8 > @llvm.sadd.sat.v2i8 (<2 x i8 > <i8 undef , i8 10 >, <2 x i8 > <i8 undef , i8 20 >)
344
+ ret <2 x i8 > %x
345
+ }
346
+
347
+ define <2 x i8 > @test_sadd_vector_op1_undef_mix2 () {
348
+ ; CHECK-LABEL: @test_sadd_vector_op1_undef_mix2(
349
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
350
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
351
+ ;
352
+ %x = call <2 x i8 > @llvm.sadd.sat.v2i8 (<2 x i8 > <i8 undef , i8 10 >, <2 x i8 > <i8 20 , i8 undef >)
353
+ ret <2 x i8 > %x
354
+ }
355
+
356
+ define <2 x i8 > @test_usub_vector_op2_undef_mix1 () {
357
+ ; CHECK-LABEL: @test_usub_vector_op2_undef_mix1(
358
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>)
359
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
360
+ ;
361
+ %x = call <2 x i8 > @llvm.usub.sat.v2i8 (<2 x i8 > <i8 10 , i8 undef >, <2 x i8 > <i8 20 , i8 undef >)
362
+ ret <2 x i8 > %x
363
+ }
364
+
365
+ define <2 x i8 > @test_usub_vector_op2_undef_mix2 () {
366
+ ; CHECK-LABEL: @test_usub_vector_op2_undef_mix2(
367
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>)
368
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
369
+ ;
370
+ %x = call <2 x i8 > @llvm.usub.sat.v2i8 (<2 x i8 > <i8 10 , i8 undef >, <2 x i8 > <i8 undef , i8 20 >)
371
+ ret <2 x i8 > %x
372
+ }
373
+
374
+ define <2 x i8 > @test_ssub_vector_op1_undef_mix1 () {
375
+ ; CHECK-LABEL: @test_ssub_vector_op1_undef_mix1(
376
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>)
377
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
378
+ ;
379
+ %x = call <2 x i8 > @llvm.ssub.sat.v2i8 (<2 x i8 > <i8 undef , i8 10 >, <2 x i8 > <i8 undef , i8 20 >)
380
+ ret <2 x i8 > %x
381
+ }
382
+
383
+ define <2 x i8 > @test_ssub_vector_op1_undef_mix2 () {
384
+ ; CHECK-LABEL: @test_ssub_vector_op1_undef_mix2(
385
+ ; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>)
386
+ ; CHECK-NEXT: ret <2 x i8> [[X]]
387
+ ;
388
+ %x = call <2 x i8 > @llvm.ssub.sat.v2i8 (<2 x i8 > <i8 undef , i8 10 >, <2 x i8 > <i8 20 , i8 undef >)
389
+ ret <2 x i8 > %x
390
+ }
0 commit comments