@@ -468,6 +468,41 @@ define <64 x i8> @fold_with_allpoison_elts_avx512(<64 x i8> %InVec) {
468
468
ret <64 x i8 > %1
469
469
}
470
470
471
+ ; Demanded bits tests (PR106256)
472
+
473
+ define <16 x i8 > @demanded_bits_mask (<16 x i8 > %InVec , <16 x i8 > %InMask ) {
474
+ ; CHECK-LABEL: @demanded_bits_mask(
475
+ ; CHECK-NEXT: [[M:%.*]] = or <16 x i8> [[INMASK:%.*]], <i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112>
476
+ ; CHECK-NEXT: [[S:%.*]] = tail call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> [[INVEC:%.*]], <16 x i8> [[M]])
477
+ ; CHECK-NEXT: ret <16 x i8> [[S]]
478
+ ;
479
+ %m = or <16 x i8 > %InMask , <i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 >
480
+ %s = tail call <16 x i8 > @llvm.x86.ssse3.pshuf.b.128 (<16 x i8 > %InVec , <16 x i8 > %m )
481
+ ret <16 x i8 > %s
482
+ }
483
+
484
+ define <32 x i8 > @demanded_bits_mask_avx2 (<32 x i8 > %InVec , <32 x i8 > %InMask ) {
485
+ ; CHECK-LABEL: @demanded_bits_mask_avx2(
486
+ ; CHECK-NEXT: [[M:%.*]] = or <32 x i8> [[INMASK:%.*]], <i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112>
487
+ ; CHECK-NEXT: [[S:%.*]] = tail call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> [[INVEC:%.*]], <32 x i8> [[M]])
488
+ ; CHECK-NEXT: ret <32 x i8> [[S]]
489
+ ;
490
+ %m = or <32 x i8 > %InMask , <i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 >
491
+ %s = tail call <32 x i8 > @llvm.x86.avx2.pshuf.b (<32 x i8 > %InVec , <32 x i8 > %m )
492
+ ret <32 x i8 > %s
493
+ }
494
+
495
+ define <64 x i8 > @demanded_bits_mask_avx512 (<64 x i8 > %InVec , <64 x i8 > %InMask ) {
496
+ ; CHECK-LABEL: @demanded_bits_mask_avx512(
497
+ ; CHECK-NEXT: [[M:%.*]] = or <64 x i8> [[INMASK:%.*]], <i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112, i8 16, i8 48, i8 112, i8 112>
498
+ ; CHECK-NEXT: [[S:%.*]] = tail call <64 x i8> @llvm.x86.avx512.pshuf.b.512(<64 x i8> [[INVEC:%.*]], <64 x i8> [[M]])
499
+ ; CHECK-NEXT: ret <64 x i8> [[S]]
500
+ ;
501
+ %m = or <64 x i8 > %InMask , <i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 , i8 16 , i8 48 , i8 112 , i8 112 >
502
+ %s = tail call <64 x i8 > @llvm.x86.avx512.pshuf.b.512 (<64 x i8 > %InVec , <64 x i8 > %m )
503
+ ret <64 x i8 > %s
504
+ }
505
+
471
506
; Demanded elts tests.
472
507
473
508
define <16 x i8 > @demanded_elts_insertion (<16 x i8 > %InVec , <16 x i8 > %BaseMask , i8 %M0 , i8 %M15 ) {
0 commit comments