[llvm] Perform bitreverse using AVX512 GFNI for i32 and i64. (PR #81764)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 08:48:47 PDT 2024
================
@@ -31332,6 +31337,21 @@ static SDValue LowerBITREVERSE(SDValue Op, const X86Subtarget &Subtarget,
if (VT.is256BitVector() && !Subtarget.hasInt256())
return splitVectorIntUnary(Op, DAG, DL);
+ // Lower i32/i64 to GFNI as i32/i64 -> Convert to vector (V = v16i32/v8i64) -> vXi8 BITREVERSE -> V[0] -> BSWAP
+ if (Subtarget.hasGFNI() && !VT.isVector()) {
+
+ assert ((VT.getScalarType() == MVT::i32) || (VT.getScalarType() == MVT::i64));
+
+ auto ScalarType = VT.getScalarType();
+ auto CastTo = ScalarType == MVT::i32 ? MVT::v4i32 : MVT::v2i64;
----------------
shamithoke wrote:
Done.
https://github.com/llvm/llvm-project/pull/81764
More information about the llvm-commits
mailing list