[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:47:46 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()) {
----------------
shamithoke wrote:

I've changed it, but then it would mean that any call to lower_bitreverse for i32/i64 (for non-GFNI targets) will get lowered as PSHUFB lookups. I thought since this PR explicitly handles GFNI target, so I will put a stringent condition. 

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


More information about the llvm-commits mailing list