[llvm] [X86] Fold XOR of two VGF2P8AFFINEQB instructions with same matrix (PR #199146)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 13 02:18:48 PDT 2026
================
@@ -56318,29 +56352,46 @@ static SDValue combineXorWithGF2P8AFFINEQB(SDNode *N, const SDLoc &DL,
DAG.getTargetConstant(NewImm, DL, MVT::i8));
}
-// Fold: vgf2p8affineqb(x, m1, i1) ^ vgf2p8affineqb(x, m2, i2)
-// => vgf2p8affineqb(x, m1 ^ m2, i1 ^ i2)
-// The matrix in vgf2p8affineqb determines which bits of the input are XORed
-// together. XORing two affine transformations of the same input can be folded
-// by XORing both their matrices and immediates together.
+// Given that vgf2p8affineqb performs a XOR permutation, two affines that share
+// a operand can be reassociated through a standalone XOR.
static SDValue combineXorWithTwoGF2P8AFFINEQB(SDNode *N, const SDLoc &DL,
SelectionDAG &DAG, EVT VT) {
using namespace SDPatternMatch;
- SDValue X0, Y0, Y1;
+ SDValue X0, X1, Y0, Y1;
----------------
phoebewang wrote:
Either use M0, M1 here, or y0, y1 in the comments to make them consistent
https://github.com/llvm/llvm-project/pull/199146
More information about the llvm-commits
mailing list