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

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 00:25:37 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");
----------------
shamithoke wrote:

Maybe the assert messages could go in the caller?

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


More information about the llvm-commits mailing list