[PATCH] D59066: [TargetLowering] improve the default expansion of uaddsat/usubsat

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 14:30:33 PDT 2019


spatel added a comment.

In D59066#1426663 <https://reviews.llvm.org/D59066#1426663>, @nikic wrote:

> @spatel D59174 <https://reviews.llvm.org/D59174> is not AArch64 specific and covers what this patch does, but only for the case where VSELECT is expanded. An alternative would be to add a combine for `vselect zero_or_neg_one, neg_one, x -> zero_or_neg_one | x` and `vselect zero_or_neg_one, 0, x -> ~zero_or_neg_one & x`, though it's arguable whether the latter is an improvement in general.


Ah, sorry - I missed the x86 diff there the first time I looked. So yes, the benefit of that patch seems clear.

And yes, the pattern with 'and-not' isn't clearly a win unless the target has that op as a single instruction, but it seems common enough that we would choose that as the optimized form here in the legalizer. So I'd go with all of these patches to try to make sure that we get optimized code for the intrinsics.


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

https://reviews.llvm.org/D59066





More information about the llvm-commits mailing list