[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 23:04:35 PST 2023


chapuni added a comment.

Will this affect other tests? I met another.



================
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:
> > 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
> We needn't enhance the case in the code. DAGCombiner will generalize these to current two patterns. Check the test:
> (X & C) >=u Pow2 in cmp_to_ands6
> (X & C) <=u Mask in cmp_to_ands4
Thanks, I understood.


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

https://reviews.llvm.org/D141829



More information about the llvm-commits mailing list