[Mlir-commits] [mlir] [mlir][ArmSVE] Add convert_to/from_svbool ops (PR #68586)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Oct 11 08:28:20 PDT 2023
================
@@ -481,10 +500,39 @@ class IsScalableVectorOfLengthPred<list<int> allowedLengths> :
== }]
# allowedlength>)>]>;
+// Normalizes an index so it can be bounds checked.
+// Negative values are mapped to their absolute value.
+// - These are used to index in reverse (i.e. index -1 would be the last element)
+// Positive values are mapped to their value + 1.
+// - This results the same range of values as the negative indices
+// This allows bounds checking to be: len(list) >= NormalizeIndex<idx>.ret.
+class NormalizeIndex<int value> {
+ int ret = !if(!lt(value, 0), !sub(0, value), !add(value, 1));
+}
----------------
banach-space wrote:
So:
* 2 --> 3
* -2 --> 2
? Why? :)
Struggling a bit with this - could you give an example of what is it that we want to achieve here? Similar comment for `IsNthDimSizeIsOneOfPred`.
https://github.com/llvm/llvm-project/pull/68586
More information about the Mlir-commits
mailing list