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

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 08:31:06 PST 2023


sdesmalen 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));
----------------
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.


================
Comment at: llvm/test/CodeGen/AArch64/sve-splat-one-and-ptrue.ll:15
+entry:
+  %0 = tail call <vscale x 4 x i1> @llvm.aarch64.sve.ptrue.nxv4i1(i32 31)
+  %1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %0)
----------------
It would also be good to have a test that uses a shufflevector to create the splat.


================
Comment at: llvm/test/CodeGen/AArch64/sve-splat-one-and-ptrue.ll:19
+  %and = and <vscale x 16 x i1> %2, %1
+  tail call void @foo(<vscale x 16 x i1> %and) #3
+  ret void
----------------
Is this function call relevant?


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

https://reviews.llvm.org/D141043



More information about the llvm-commits mailing list