[llvm] [AArch64] Lower fixed find_last_active to LASTP with SVE2.2 (PR #222534)

Vimal Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 06:51:07 PDT 2026


================
@@ -8283,6 +8293,36 @@ SDValue AArch64TargetLowering::LowerVECTOR_COMPRESS(SDValue Op,
                      Passthru);
 }
 
+SDValue
+AArch64TargetLowering::LowerVECTOR_FIND_LAST_ACTIVE(SDValue Op,
+                                                    SelectionDAG &DAG) const {
+  assert((Subtarget->hasSVE2p2() || Subtarget->hasSME2p2()) &&
+         "custom lowering requires LASTP");
+  SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::i32);
+  return DAG.getNode(AArch64ISD::FIND_LAST_ACTIVE, SDLoc(Op), VTs,
+                     Op.getOperand(0));
+}
+
+SDValue AArch64TargetLowering::expandFindLastActive(SDValue Op,
----------------
pvimal816a wrote:

> For point 2 I think this optimization should a separate patch, as it seems to be unnecessary to lowering of VECTOR_FIND_LAST_ACTIVE into LASTP ? It will make it easier to review and see how that combine improved the codegen. Are you okay with doing that ?

Yeah, Sure. I would have preferred a separate commit instead of a PR but seems like both the commits would get squashed at the time of merging. So, I would need to create a PR to preserve separate commits.

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


More information about the llvm-commits mailing list