llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[X86] Missed Fold: `vgf2p8affineqb(x, m, imm8) ^ C` => `vgf2p8affineqb(x, m, imm8 ^ C)`

Open WalterKruger opened this issue 10 months ago • 3 comments

The immediate in the vgf2p8affineqb instruction applies a XOR after the main affine transformation. This can be folded with standalone XORs by any splatted 8-bit constants.

affineNot_clang:
        gf2p8affineqb   xmm0, xmm1, 0
        pcmpeqd xmm1, xmm1
        pxor    xmm0, xmm1
        ret
affineNot_tgt:
        gf2p8affineqb   xmm0, xmm1, 255
        ret

https://godbolt.org/z/4qhG5fGq3

WalterKruger avatar Jan 30 '26 00:01 WalterKruger

@llvm/issue-subscribers-backend-x86

Author: Walter (WalterKruger)

The immediate in the `vgf2p8affineqb` instruction applies a XOR after the main affine transformation. This can be folded with standalone XORs by any splatted 8-bit constants.
affineNot_clang:
        gf2p8affineqb   xmm0, xmm1, 0
        pcmpeqd xmm1, xmm1
        pxor    xmm0, xmm1
        ret
affineNot_tgt:
        gf2p8affineqb   xmm0, xmm1, 255
        ret

https://godbolt.org/z/4qhG5fGq3

llvmbot avatar Jan 30 '26 00:01 llvmbot

@WalterKruger i would like to work on this issue .

bala-bhargav avatar Jan 30 '26 05:01 bala-bhargav

This appears to be fixed by #179103, which has already been merged.

WalterKruger avatar Feb 07 '26 00:02 WalterKruger