[PATCH] D141829: Reapply [AArch64] fold subs ugt/ult to ands when the second operand is mask/pow2

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 20:40:16 PST 2023


chapuni added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:19817
+// (X & C) >u Mask --> (X & (C & (~Mask)) != 0
+// (X & C) <u Mask --> (X & (C & (~Mask)) == 0
+static SDValue performSubsToAndsCombine(SDNode *N, SDNode *SubsNode,
----------------
bcl5980 wrote:
> chapuni wrote:
> > I think the latter is wrong.
> > eg. X=11 C=7 M=3
> Thanks for the case.
> I will send a quick fix for that.
I reconfirmed the new expr is correct.
(not tested yet for bootstrap, though)

Could you enhance to add also them?

(X & C) >=u Pow2
(X & C) <=u Mask


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141829/new/

https://reviews.llvm.org/D141829



More information about the llvm-commits mailing list