[llvm] [AArch64] Combine PTEST_FIRST(PTRUE, CONCAT(A, B)) -> PTEST_FIRST(PTRUE, A) (PR #161384)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 08:30:43 PDT 2025
================
@@ -27519,6 +27534,32 @@ static SDValue performMULLCombine(SDNode *N,
return SDValue();
}
+static SDValue performPTestFirstCombine(SDNode *N,
+ TargetLowering::DAGCombinerInfo &DCI,
+ SelectionDAG &DAG) {
+ if (DCI.isBeforeLegalize())
+ return SDValue();
+
+ SDLoc DL(N);
+ auto Mask = N->getOperand(0);
+ auto Pred = N->getOperand(1);
+
+ if (Pred->getOpcode() == AArch64ISD::REINTERPRET_CAST)
+ Pred = Pred->getOperand(0);
+
+ if (!isLane0KnownActive(Mask))
+ return SDValue();
----------------
paulwalker-arm wrote:
Perhaps move this before looking through Pred's reinterpret_cast because this is what makes that code logically safe.
https://github.com/llvm/llvm-project/pull/161384
More information about the llvm-commits
mailing list