[llvm] [X86][AVX512] Better lowering for `_mm512_maskz_shuffle_epi32` (PR #121147)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 06:49:16 PDT 2025


================
@@ -990,3 +990,38 @@ bb:
   ret void
 }
 
+define <16 x i32> @shuffle_v16f32_00_18_02_18_4_22_06_22_08_26_10_26_12_30_14_30(<16 x i32> %a) {
+; AVX512F-LABEL: shuffle_v16f32_00_18_02_18_4_22_06_22_08_26_10_26_12_30_14_30:
+; AVX512F:       # %bb.0:
+; AVX512F-NEXT:    movw $-21846, %ax # imm = 0xAAAA
+; AVX512F-NEXT:    kmovw %eax, %k1
+; AVX512F-NEXT:    vpshufd {{.*#+}} zmm0 {%k1} {z} = zmm0[2,2,2,2,6,6,6,6,10,10,10,10,14,14,14,14]
+; AVX512F-NEXT:    retq
+;
+; AVX512BW-LABEL: shuffle_v16f32_00_18_02_18_4_22_06_22_08_26_10_26_12_30_14_30:
+; AVX512BW:       # %bb.0:
+; AVX512BW-NEXT:    movw $-21846, %ax # imm = 0xAAAA
+; AVX512BW-NEXT:    kmovd %eax, %k1
+; AVX512BW-NEXT:    vpshufd {{.*#+}} zmm0 {%k1} {z} = zmm0[2,2,2,2,6,6,6,6,10,10,10,10,14,14,14,14]
+; AVX512BW-NEXT:    retq
----------------
RKSimon wrote:

Still not sure if this wouldn't be better off as a VPSHUFB node

https://github.com/llvm/llvm-project/pull/121147


More information about the llvm-commits mailing list