[llvm] [X86] Use GFNI for vXi8 shifts/rotates (PR #89115)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 10:33:38 PDT 2024
================
@@ -98,34 +72,25 @@ define <16 x i8> @splatconstant_ashr_v16i8(<16 x i8> %a) nounwind {
define <32 x i8> @splatconstant_shl_v32i8(<32 x i8> %a) nounwind {
; GFNISSE-LABEL: splatconstant_shl_v32i8:
; GFNISSE: # %bb.0:
-; GFNISSE-NEXT: psllw $6, %xmm0
-; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192]
-; GFNISSE-NEXT: pand %xmm2, %xmm0
-; GFNISSE-NEXT: psllw $6, %xmm1
-; GFNISSE-NEXT: pand %xmm2, %xmm1
+; GFNISSE-NEXT: pmovsxwq {{.*#+}} xmm2 = [258,258]
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm0
+; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm1
; GFNISSE-NEXT: retq
;
; GFNIAVX1-LABEL: splatconstant_shl_v32i8:
; GFNIAVX1: # %bb.0:
-; GFNIAVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
-; GFNIAVX1-NEXT: vpsllw $6, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vbroadcastss {{.*#+}} xmm2 = [192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192]
-; GFNIAVX1-NEXT: vpand %xmm2, %xmm1, %xmm1
-; GFNIAVX1-NEXT: vpsllw $6, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
-; GFNIAVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
+; GFNIAVX1-NEXT: vgf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
; GFNIAVX1-NEXT: retq
;
; GFNIAVX2-LABEL: splatconstant_shl_v32i8:
; GFNIAVX2: # %bb.0:
-; GFNIAVX2-NEXT: vpsllw $6, %ymm0, %ymm0
-; GFNIAVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
----------------
RKSimon wrote:
I'll look at the funnel shift codegen.
Regarding the broadcast - lowerBuildVectorAsBroadcast will only attempt to match i32/i64 constant broadcasts - nothing smaller as Haswell struggled with i8/i16 perf - we went from a v16i16 to a v4i64 constant broadcast. I really want to stop lowering to broadcasting constants in DAG entirely and allow X86FixupVectorConstants to handle it all, but there's still a lot of minor issues to address - #73509 started the work on AVX512 but it keeps getting dropped down my TODO list :(
https://github.com/llvm/llvm-project/pull/89115
More information about the llvm-commits
mailing list