[PATCH] D123043: [X86] Add XOR(X, MIN_SIGNED_VALUE) -> ADD(X, MIN_SIGNED_VALUE) isel patterns (PR52267)
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 4 11:03:27 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/X86/X86InstrCompiler.td:1529
+
+let AddedComplexity = 5 in {
+def : Pat<(xor_is_add GR8:$src1, imm:$src2),
----------------
craig.topper wrote:
> It occurs to me you could avoid the AddedComplexity by writing
>
> ```
> def : Pat<(xor GR8:$src1, 128),
> (ADD8ri GR8:$src1, 128)>;
> def : Pat<(xor GR16:$src1, 32768),
> (ADD16ri GR16:$src1, 32768)>;
> def : Pat<(xor GR32:$src1, 2147483648),
> (ADD32ri GR32:$src1, 2147483648)>;
> ```
Those might need to be negative constants.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123043/new/
https://reviews.llvm.org/D123043
More information about the llvm-commits
mailing list