[PATCH] D111034: [AArch64] Optimize add/sub with immediate

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 08:20:58 PDT 2021


dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

In D111034#3058614 <https://reviews.llvm.org/D111034#3058614>, @benshi001 wrote:

> In D111034#3058375 <https://reviews.llvm.org/D111034#3058375>, @dmgreen wrote:
>
>> Thanks. Code looks good to me.
>>
>> Are there test cases anywhere for having these adds in a loop? And for negative tests where we are out of range for the transform?
>
> We do not have such tests, I will add three more tests,
>
> 1. add/sub 0x1ffffff, which exceeds 0xffffff;
> 2. add/sub 0xaaaa, which does not exceed 0xffffff, but can be composed to (add x, (mov y, 0xaaaa));
> 3. add/sub 0xaaaaaa inside a loop and this split optimization is blocked.
>
> Do you think enough ?
>
> Thank you.

Yeah that sounds good to me. Thanks. If you add those, this patch LGTM.



================
Comment at: llvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp:146
   // of UImm to zero.
   if (SubregToRegMI)
     UImm &= 0xFFFFFFFF;
----------------
benshi001 wrote:
> dmgreen wrote:
> > Do we need the equivalent of this in the new code? Or i s it Ok because of the 0xffffff check at the start of splitAddSubImm?
> I do not think we need such operation, since the check in splitAddSubImm has guarenteed that.
OK sounds good.


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

https://reviews.llvm.org/D111034



More information about the llvm-commits mailing list