[PATCH] D137547: [AArch64][SVE] Use PTRUE instruction for get_active_lane_mask intrinsic if the range is from 0 to SVE predicator constant

Peter Waller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 04:49:25 PST 2022


peterwaller-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:17454-17455
+          N->getConstantOperandVal(1) == 0 &&
+          N->getConstantOperandVal(2) <
+              N->getValueType(0).getVectorMinNumElements() &&
+          getSVEPredPatternFromNumElements(N->getConstantOperandVal(2)) != None)
----------------
Unless I'm missing something, this condition doesn't look right.

I suspect this combine could happen before legalization in which case you could have `vscale x [big] x something`, and the `[big]` you're testing against here could exceed the runtime vector length -- and then you're hitting the problem Paul pointed out that ptrue would return an empty predicate.

I take to account for this properly you're going to need to query the minimum vscale via `SubTarget->getMinSVEVectorSizeInBits()`.


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

https://reviews.llvm.org/D137547



More information about the llvm-commits mailing list