@@ -468,6 +468,38 @@ define <64 x i8> @fold_with_allpoison_elts_avx512(<64 x i8> %InVec) {
468468 ret <64 x i8 > %1
469469}
470470
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: [[S:%.*]] = tail call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> [[INVEC:%.*]], <16 x i8> [[INMASK:%.*]])
476+ ; CHECK-NEXT: ret <16 x i8> [[S]]
477+ ;
478+ %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 >
479+ %s = tail call <16 x i8 > @llvm.x86.ssse3.pshuf.b.128 (<16 x i8 > %InVec , <16 x i8 > %m )
480+ ret <16 x i8 > %s
481+ }
482+
483+ define <32 x i8 > @demanded_bits_mask_avx2 (<32 x i8 > %InVec , <32 x i8 > %InMask ) {
484+ ; CHECK-LABEL: @demanded_bits_mask_avx2(
485+ ; CHECK-NEXT: [[S:%.*]] = tail call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> [[INVEC:%.*]], <32 x i8> [[INMASK:%.*]])
486+ ; CHECK-NEXT: ret <32 x i8> [[S]]
487+ ;
488+ %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 >
489+ %s = tail call <32 x i8 > @llvm.x86.avx2.pshuf.b (<32 x i8 > %InVec , <32 x i8 > %m )
490+ ret <32 x i8 > %s
491+ }
492+
493+ define <64 x i8 > @demanded_bits_mask_avx512 (<64 x i8 > %InVec , <64 x i8 > %InMask ) {
494+ ; CHECK-LABEL: @demanded_bits_mask_avx512(
495+ ; CHECK-NEXT: [[S:%.*]] = tail call <64 x i8> @llvm.x86.avx512.pshuf.b.512(<64 x i8> [[INVEC:%.*]], <64 x i8> [[INMASK:%.*]])
496+ ; CHECK-NEXT: ret <64 x i8> [[S]]
497+ ;
498+ %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 >
499+ %s = tail call <64 x i8 > @llvm.x86.avx512.pshuf.b.512 (<64 x i8 > %InVec , <64 x i8 > %m )
500+ ret <64 x i8 > %s
501+ }
502+
471503; Demanded elts tests.
472504
473505define <16 x i8 > @demanded_elts_insertion (<16 x i8 > %InVec , <16 x i8 > %BaseMask , i8 %M0 , i8 %M15 ) {
0 commit comments