Skip to content

[X86] Missed Fold: vgf2p8affineqb(x0, m) ^ vgf2p8affineqb(x1, m) => vgf2p8affineqb(x0 ^ x1, m) #196879

@WalterKruger

Description

@WalterKruger

Given that vgf2p8affineqb performs an XOR permutation of the input, and that XORs are associated, XORing two values that where transformed in the same manner can be reassociated to happen before. Their immediates also need to be XORed together as well:

gfniXor_src:
        gf2p8affineqb   xmm0, xmm2, 1
        gf2p8affineqb   xmm1, xmm2, 3
        pxor    xmm0, xmm1
        ret
gfniXor_tgt:
        pxor    xmm0, xmm1
        gf2p8affineqb   xmm0, xmm2, 2
        ret

https://godbolt.org/z/16or45959

Most nodes that lower to vgf2p8affineqb already perform this fold so this mostly applies to intrinsics.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions