[PATCH] D137026: [X86] Use GFNI for vXi8 shifts/rotates

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 12 07:26:08 PST 2022


pengfei added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:30193
+      uint64_t ShiftMask = getGFNICtrlImm(Op.getOpcode(), ShiftAmt);
+      MVT MaskVT = MVT::getVectorVT(MVT::i64, VT.getSizeInBits() / 64);
+      SDValue Mask = DAG.getBitcast(VT, DAG.getConstant(ShiftMask, dl, MaskVT));
----------------
ditto.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:31062
+      (VT == MVT::v16i8 || (VT == MVT::v32i8 && Subtarget.hasAVX()) ||
+       (VT == MVT::v64i8 && Subtarget.useBWIRegs()))) {
+    uint64_t RotAmt = CstSplatValue.urem(EltSizeInBits);
----------------
Do we need to check it here? Can we simply use `isTypeLegal(VT)`?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:31065
+    uint64_t RotMask = getGFNICtrlImm(Opcode, RotAmt);
+    MVT MaskVT = MVT::getVectorVT(MVT::i64, VT.getSizeInBits() / 64);
+    SDValue Mask = DAG.getBitcast(VT, DAG.getConstant(RotMask, DL, MaskVT));
----------------
Use `NumElts / 8` like below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137026/new/

https://reviews.llvm.org/D137026



More information about the llvm-commits mailing list