[X86] Missed Fold: `vgf2p8affineqb(x, m1) ^ vgf2p8affineqb(x, m2)` => `vgf2p8affineqb(x, m1 ^ m2)`
The matrix in vgf2p8affineqb can be interpreted as determining which bits of the input are XORed together for each position. Following from that, XORing two affines of the same input can be folded by XORing both their matrices and immediates together into a single vgf2p8affineqb instruction.
src:
vgf2p8affineqb xmm1, xmm0, xmm1, 0
vgf2p8affineqb xmm0, xmm0, xmm2, 0
vpxor xmm0, xmm0, xmm1
ret
tgt:
vpxor xmm1, xmm2, xmm1
vgf2p8affineqb xmm0, xmm0, xmm1, 0
ret
https://godbolt.org/z/jK8eWPhb7
This can also be applied to vgf2p8affineqb(x, m) ^ x, as the standalone x can be interpreted as being affined by the neutral matrix.
@llvm/issue-subscribers-backend-x86
Author: Walter (WalterKruger)
src:
vgf2p8affineqb xmm1, xmm0, xmm1, 0
vgf2p8affineqb xmm0, xmm0, xmm2, 0
vpxor xmm0, xmm0, xmm1
ret
tgt:
vpxor xmm1, xmm2, xmm1
vgf2p8affineqb xmm0, xmm0, xmm1, 0
ret
https://godbolt.org/z/jK8eWPhb7
This can also be applied to vgf2p8affineqb(x, m) ^ x, as the standalone x can be interpreted as being affined by the neutral matrix.
@WalterKruger can i work on this ??
Fixed by #179900