[PATCH] D128606: [AArch64][DAGCombiner] Swap the operations of logical operation AND to match movprfx

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 05:07:17 PDT 2022


Allen added a comment.

In D128606#3615200 <https://reviews.llvm.org/D128606#3615200>, @paulwalker-arm wrote:

> Is this optimisation valid? The merging SVE intrinsics have strict rules about what happens to inactive lanes. For the `llvm.aarch64.sve.and` the inactive lanes are set to the matching lanes of the first operand.  This means that the inactive lanes of the second operand play no role in the operation and thus the example in `and_i64_zero_comm` is not a `zeroing and`.
>
> However, given the inactive lanes of the second operand play no role, this effectively means the `select` is redundant and can be optimised away as an instcombine before it gets to code generation.  So I guess the question is whether you are seeing this issue in real code and thus it's worth implementing the instcombine.

Oh, sorry, and thanks @paulwalker-arm for your reminder . I forgot to use clang end-to-end to confirm the final assembly, At first thought it will be better performance to generate movprfx, without realizing that the `select` is redundant in this case.
Indeed, the instructions generated by the s113_tuned version are more efficient.


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

https://reviews.llvm.org/D128606



More information about the llvm-commits mailing list