[llvm] [AArch64] Fold vector select with power-of-2 bit-test to CMTST+BSP (PR #209100)
Mugundan S via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 20:51:42 PDT 2026
================
@@ -29067,6 +29089,43 @@ static SDValue performSETCCCombine(SDNode *N,
SplatLHSVal.isOne())
return DAG.getSetCC(DL, VT, DAG.getConstant(0, DL, CmpVT), RHS, ISD::SETGE);
+ // Fold setcc(and(X, Mask), Mask/0, eq/ne) --> [not] AArch64ISD::CMTST(X,
+ // Mask) for a power of 2 splat Mask, replacing AND+CMEQ with a single CMTST.
+ // Any NOT folds away when the result feeds a BSL/BIF/BIT select.
+ if (!DCI.isBeforeLegalize() && CmpVT.isFixedLengthVector() &&
----------------
MGN-GIT wrote:
Yeah that's sounds correct
https://github.com/llvm/llvm-project/pull/209100
More information about the llvm-commits
mailing list