[llvm] [X86] Fold nested VGF2P8AFFINEQB instructions (PR #195210)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 02:17:18 PDT 2026


================
@@ -29420,6 +29420,25 @@ SDValue getGFNICtrlMask(unsigned Opcode, SelectionDAG &DAG, const SDLoc &DL,
   return DAG.getBuildVector(VT, DL, MaskBits);
 }
 
+static APInt getGFNIByteAffine(const APInt &ByteToAffine, const APInt &Matrix64,
+                               const APInt &Addend8) {
+  assert(ByteToAffine.getBitWidth() == 8 && "Byte input unexpected size!");
+  assert(Addend8.getBitWidth() == 8 && "8-bit addend input unexpected size!");
+  assert(Matrix64.getBitWidth() == 64 &&
+         "64-bit matrix input unexpected size!");
+
+  APInt ByteSplat = APInt::getSplat(64, ByteToAffine);
+  ByteSplat &= Matrix64.byteSwap();
+
+  // Cumulative parity
+  for (unsigned i = 0; i < 3; ++i)
----------------
RKSimon wrote:

```suggestion
  for (unsigned I = 0; i != 3; ++I)
```

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


More information about the llvm-commits mailing list