[llvm] [X86] Use GFNI for vXi8 shifts/rotates (PR #89115)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 19:58:43 PDT 2024


================
@@ -28964,6 +28964,33 @@ SDValue X86TargetLowering::LowerWin64_INT128_TO_FP(SDValue Op,
   return IsStrict ? DAG.getMergeValues({Result, Chain}, dl) : Result;
 }
 
+// Generate a GFNI gf2p8affine bitmask for vXi8 bitreverse/shift/rotate.
+uint64_t getGFNICtrlImm(unsigned Opcode, unsigned Amt = 0) {
+  switch (Opcode) {
+  case ISD::BITREVERSE:
+    return 0x8040201008040201ULL;
+  case ISD::SHL:
+    assert((0 < Amt && Amt < 8) && "Shift amount out of range");
----------------
phoebewang wrote:

Maybe just assert once out of switch?

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


More information about the llvm-commits mailing list