[PATCH] D141043: [AArch64][SVE] Avoid AND operation if both side are splat of i1 or PTRUE

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 01:38:50 PST 2023


david-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:16271
+  // we can produce just i1 splat_vector as the result
+  SDValue Op0 = findRootNonReinterpretNode(Src);
+  SDValue Op1 = findRootNonReinterpretNode(N->getOperand(1));
----------------
dtemirbulatov wrote:
> sdesmalen wrote:
> > I think you can use the existing function `isAllActivePredicate` to check if either of the operands is an all active-predicate. This function already looks through reinterpret nodes and already checks both the splat/ptrue case.
> but I need to check and return ptrue/splat node and isAllActivePredicate() just checks.
Hi @dtemirbulatov, I'm re-reading this code and `isAllActivePredicate`. I actually think @sdesmalen is right and we should use `isAllActivePredicate` here, because your current code doesn't take into account various cases such as:

1. When reinterpreting from a type with fewer elements the "new" elements are not active, so I think we should bail out of this optimisation in this case.
2. Your code below doesn't consider what type of pattern is being passed to ptrue, but we should be. `isAllActivePredicate` only returns true for `AArch64SVEPredPattern::all`.

For any cases where we bail out I think it's worth adding a negative test as well.


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

https://reviews.llvm.org/D141043



More information about the llvm-commits mailing list