@@ -334,4 +334,164 @@ define void @sdiv_v128i16(<128 x i16>* %a, <128 x i16>* %b) #0 {
334
334
ret void
335
335
}
336
336
337
+ ; Vector v2i32 sdiv are not legal for NEON so use SVE when available.
338
+ define <2 x i32 > @sdiv_v2i32 (<2 x i32 > %op1 , <2 x i32 > %op2 ) #0 {
339
+ ; CHECK-LABEL: sdiv_v2i32:
340
+ ; CHECK: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),2)]]
341
+ ; CHECK: sdiv z0.s, [[PG]]/m, z0.s, z1.s
342
+ ; CHECK: ret
343
+ %res = sdiv <2 x i32 > %op1 , %op2
344
+ ret <2 x i32 > %res
345
+ }
346
+
347
+ ; Vector v4i32 sdiv are not legal for NEON so use SVE when available.
348
+ define <4 x i32 > @sdiv_v4i32 (<4 x i32 > %op1 , <4 x i32 > %op2 ) #0 {
349
+ ; CHECK-LABEL: sdiv_v4i32:
350
+ ; CHECK: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),4)]]
351
+ ; CHECK: sdiv z0.s, [[PG]]/m, z0.s, z1.s
352
+ ; CHECK: ret
353
+ %res = sdiv <4 x i32 > %op1 , %op2
354
+ ret <4 x i32 > %res
355
+ }
356
+
357
+ define void @sdiv_v8i32 (<8 x i32 >* %a , <8 x i32 >* %b ) #0 {
358
+ ; CHECK-LABEL: sdiv_v8i32:
359
+ ; VBITS_GE_256: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),8)]]
360
+ ; VBITS_GE_256-NEXT: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
361
+ ; VBITS_GE_256-NEXT: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
362
+ ; VBITS_GE_256-NEXT: sdiv [[RES:z[0-9]+]].s, [[PG]]/m, [[OP1]].s, [[OP2]].s
363
+ ; VBITS_GE_256-NEXT: st1w { [[RES]].s }, [[PG]], [x0]
364
+ ; VBITS_GE_256-NEXT: ret
365
+ %op1 = load <8 x i32 >, <8 x i32 >* %a
366
+ %op2 = load <8 x i32 >, <8 x i32 >* %b
367
+ %res = sdiv <8 x i32 > %op1 , %op2
368
+ store <8 x i32 > %res , <8 x i32 >* %a
369
+ ret void
370
+ }
371
+
372
+ define void @sdiv_v16i32 (<16 x i32 >* %a , <16 x i32 >* %b ) #0 {
373
+ ; CHECK-LABEL: sdiv_v16i32:
374
+ ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),16)]]
375
+ ; VBITS_GE_512-NEXT: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
376
+ ; VBITS_GE_512-NEXT: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
377
+ ; VBITS_GE_512-NEXT: sdiv [[RES:z[0-9]+]].s, [[PG]]/m, [[OP1]].s, [[OP2]].s
378
+ ; VBITS_GE_512-NEXT: st1w { [[RES]].s }, [[PG]], [x0]
379
+ ; VBITS_GE_512-NEXT: ret
380
+ %op1 = load <16 x i32 >, <16 x i32 >* %a
381
+ %op2 = load <16 x i32 >, <16 x i32 >* %b
382
+ %res = sdiv <16 x i32 > %op1 , %op2
383
+ store <16 x i32 > %res , <16 x i32 >* %a
384
+ ret void
385
+ }
386
+
387
+ define void @sdiv_v32i32 (<32 x i32 >* %a , <32 x i32 >* %b ) #0 {
388
+ ; CHECK-LABEL: sdiv_v32i32:
389
+ ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),32)]]
390
+ ; VBITS_GE_1024-NEXT: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
391
+ ; VBITS_GE_1024-NEXT: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
392
+ ; VBITS_GE_1024-NEXT: sdiv [[RES:z[0-9]+]].s, [[PG]]/m, [[OP1]].s, [[OP2]].s
393
+ ; VBITS_GE_1024-NEXT: st1w { [[RES]].s }, [[PG]], [x0]
394
+ ; VBITS_GE_1024-NEXT: ret
395
+ %op1 = load <32 x i32 >, <32 x i32 >* %a
396
+ %op2 = load <32 x i32 >, <32 x i32 >* %b
397
+ %res = sdiv <32 x i32 > %op1 , %op2
398
+ store <32 x i32 > %res , <32 x i32 >* %a
399
+ ret void
400
+ }
401
+
402
+ define void @sdiv_v64i32 (<64 x i32 >* %a , <64 x i32 >* %b ) #0 {
403
+ ; CHECK-LABEL: sdiv_v64i32:
404
+ ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].s, vl[[#min(div(VBYTES,4),64)]]
405
+ ; VBITS_GE_2048-NEXT: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
406
+ ; VBITS_GE_2048-NEXT: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
407
+ ; VBITS_GE_2048-NEXT: sdiv [[RES:z[0-9]+]].s, [[PG]]/m, [[OP1]].s, [[OP2]].s
408
+ ; VBITS_GE_2048-NEXT: st1w { [[RES]].s }, [[PG]], [x0]
409
+ ; VBITS_GE_2048-NEXT: ret
410
+ %op1 = load <64 x i32 >, <64 x i32 >* %a
411
+ %op2 = load <64 x i32 >, <64 x i32 >* %b
412
+ %res = sdiv <64 x i32 > %op1 , %op2
413
+ store <64 x i32 > %res , <64 x i32 >* %a
414
+ ret void
415
+ }
416
+
417
+ ; Vector i64 sdiv are not legal for NEON so use SVE when available.
418
+ define <1 x i64 > @sdiv_v1i64 (<1 x i64 > %op1 , <1 x i64 > %op2 ) #0 {
419
+ ; CHECK-LABEL: sdiv_v1i64:
420
+ ; CHECK: ptrue [[PG:p[0-9]+]].d, vl1
421
+ ; CHECK: sdiv z0.d, [[PG]]/m, z0.d, z1.d
422
+ ; CHECK: ret
423
+ %res = sdiv <1 x i64 > %op1 , %op2
424
+ ret <1 x i64 > %res
425
+ }
426
+
427
+ ; Vector i64 sdiv are not legal for NEON so use SVE when available.
428
+ define <2 x i64 > @sdiv_v2i64 (<2 x i64 > %op1 , <2 x i64 > %op2 ) #0 {
429
+ ; CHECK-LABEL: sdiv_v2i64:
430
+ ; CHECK: ptrue [[PG:p[0-9]+]].d, vl2
431
+ ; CHECK: sdiv z0.d, [[PG]]/m, z0.d, z1.d
432
+ ; CHECK: ret
433
+ %res = sdiv <2 x i64 > %op1 , %op2
434
+ ret <2 x i64 > %res
435
+ }
436
+
437
+ define void @sdiv_v4i64 (<4 x i64 >* %a , <4 x i64 >* %b ) #0 {
438
+ ; CHECK-LABEL: sdiv_v4i64:
439
+ ; VBITS_GE_256: ptrue [[PG:p[0-9]+]].d, vl[[#min(div(VBYTES,8),4)]]
440
+ ; VBITS_GE_256-NEXT: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
441
+ ; VBITS_GE_256-NEXT: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
442
+ ; VBITS_GE_256-NEXT: sdiv [[RES:z[0-9]+]].d, [[PG]]/m, [[OP1]].d, [[OP2]].d
443
+ ; VBITS_GE_256-NEXT: st1d { [[RES]].d }, [[PG]], [x0]
444
+ ; VBITS_GE_256-NEXT: ret
445
+ %op1 = load <4 x i64 >, <4 x i64 >* %a
446
+ %op2 = load <4 x i64 >, <4 x i64 >* %b
447
+ %res = sdiv <4 x i64 > %op1 , %op2
448
+ store <4 x i64 > %res , <4 x i64 >* %a
449
+ ret void
450
+ }
451
+
452
+ define void @sdiv_v8i64 (<8 x i64 >* %a , <8 x i64 >* %b ) #0 {
453
+ ; CHECK-LABEL: sdiv_v8i64:
454
+ ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].d, vl[[#min(div(VBYTES,8),8)]]
455
+ ; VBITS_GE_512-NEXT: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
456
+ ; VBITS_GE_512-NEXT: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
457
+ ; VBITS_GE_512-NEXT: sdiv [[RES:z[0-9]+]].d, [[PG]]/m, [[OP1]].d, [[OP2]].d
458
+ ; VBITS_GE_512-NEXT: st1d { [[RES]].d }, [[PG]], [x0]
459
+ ; VBITS_GE_512-NEXT: ret
460
+ %op1 = load <8 x i64 >, <8 x i64 >* %a
461
+ %op2 = load <8 x i64 >, <8 x i64 >* %b
462
+ %res = sdiv <8 x i64 > %op1 , %op2
463
+ store <8 x i64 > %res , <8 x i64 >* %a
464
+ ret void
465
+ }
466
+
467
+ define void @sdiv_v16i64 (<16 x i64 >* %a , <16 x i64 >* %b ) #0 {
468
+ ; CHECK-LABEL: sdiv_v16i64:
469
+ ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].d, vl[[#min(div(VBYTES,8),16)]]
470
+ ; VBITS_GE_1024-NEXT: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
471
+ ; VBITS_GE_1024-NEXT: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
472
+ ; VBITS_GE_1024-NEXT: sdiv [[RES:z[0-9]+]].d, [[PG]]/m, [[OP1]].d, [[OP2]].d
473
+ ; VBITS_GE_1024-NEXT: st1d { [[RES]].d }, [[PG]], [x0]
474
+ ; VBITS_GE_1024-NEXT: ret
475
+ %op1 = load <16 x i64 >, <16 x i64 >* %a
476
+ %op2 = load <16 x i64 >, <16 x i64 >* %b
477
+ %res = sdiv <16 x i64 > %op1 , %op2
478
+ store <16 x i64 > %res , <16 x i64 >* %a
479
+ ret void
480
+ }
481
+
482
+ define void @sdiv_v32i64 (<32 x i64 >* %a , <32 x i64 >* %b ) #0 {
483
+ ; CHECK-LABEL: sdiv_v32i64:
484
+ ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].d, vl[[#min(div(VBYTES,8),32)]]
485
+ ; VBITS_GE_2048-NEXT: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
486
+ ; VBITS_GE_2048-NEXT: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
487
+ ; VBITS_GE_2048-NEXT: sdiv [[RES:z[0-9]+]].d, [[PG]]/m, [[OP1]].d, [[OP2]].d
488
+ ; VBITS_GE_2048-NEXT: st1d { [[RES]].d }, [[PG]], [x0]
489
+ ; VBITS_GE_2048-NEXT: ret
490
+ %op1 = load <32 x i64 >, <32 x i64 >* %a
491
+ %op2 = load <32 x i64 >, <32 x i64 >* %b
492
+ %res = sdiv <32 x i64 > %op1 , %op2
493
+ store <32 x i64 > %res , <32 x i64 >* %a
494
+ ret void
495
+ }
496
+
337
497
attributes #0 = { "target-features" ="+sve" }
0 commit comments