[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));
+}
+
+// Whether the n-th dim of the shape matches the given `size`.
+// Negative values index in reverse.
----------------
banach-space wrote:

What is `size`? Or did you mean `allowedSizes[n]`?

In general, quite unsure what this does. Could you add an example of what would be accepted and what would be rejected?

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


More information about the Mlir-commits mailing list