[llvm] [AArch64] Move BSL generation to lowering. (PR #151855)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 02:54:06 PDT 2025


================
@@ -14808,14 +14800,13 @@ static SDValue tryCombineToBSL(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
   // We only have to look for constant vectors here since the general, variable
   // case can be handled in TableGen.
   unsigned Bits = VT.getScalarSizeInBits();
-  uint64_t BitMask = Bits == 64 ? -1ULL : ((1ULL << Bits) - 1);
   for (int i = 1; i >= 0; --i)
     for (int j = 1; j >= 0; --j) {
       APInt Val1, Val2;
 
       if (ISD::isConstantSplatVector(N0->getOperand(i).getNode(), Val1) &&
           ISD::isConstantSplatVector(N1->getOperand(j).getNode(), Val2) &&
-          (BitMask & ~Val1.getZExtValue()) == Val2.getZExtValue()) {
+          ~Val1.trunc(Bits) == Val2.trunc(Bits)) {
----------------
rj-jesus wrote:

I guess the issue here and below was that the mask wasn't applied to both sides? Either way, I think the new version looks good.

https://github.com/llvm/llvm-project/pull/151855


More information about the llvm-commits mailing list