[PATCH] D140087: [X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 29 09:39:34 PST 2022
goldstein.w.n marked an inline comment as done.
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:4009-4010
+
+ } else if ((Add0C && Add0C->getAPIntValue().urem(Size) == Size - 1) ||
+ (Add1C && Add1C->getAPIntValue().urem(Size) == Size - 1)) {
+ // If we are doing a NOT on just the lower bits with (Size*N-1) -/^ X
----------------
goldstein.w.n wrote:
> lebedev.ri wrote:
> > xor https://alive2.llvm.org/ce/z/k_3jok
> > sub from bias https://alive2.llvm.org/ce/z/-BBhDe
> > BUT NOT sub of bias: https://alive2.llvm.org/ce/z/AY9Aa7
> > and not add: https://alive2.llvm.org/ce/z/yUyTC7
> Ah, good catch.
>
> Fixing and will add test case in `not-shift.ll`.
>
> Sorry for missing that.
Fixed. The Guard the condition against `add` and only transform `sub` if its `(Size - 1) - X`, not `X - (Size - 1)`
Added some tests for it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140087/new/
https://reviews.llvm.org/D140087
More information about the llvm-commits
mailing list