[llvm] [AArch64] Add @llvm.experimental.vector.match (PR #101974)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 03:11:11 PDT 2024
https://github.com/david-arm commented:
My biggest concern about this patch is the intrinsic looks to me too SVE-specific to be a general intrinsic. For the actual problem you want to solve using SVE's match instruction, what's the bare minimum you need to do? For example, do you really need multiple search segments? Consider a loop like this:
```
for (unsigned i = 0; i < n; i++) {
Found[i] = false;
for (unsigned j = 0; j < 4; j++) {
if (vec[i] == search[j]) {
Found[i] = true;
break;
}
}
}
```
In the example above every element of `vec` is always being compared against the same 4 elements of search. So effectively this is only one segment to search. That would mean the generic intrinsic only needs to talk about searching the first four elements of the second vector, which significantly reduces the complexity and makes it easier to provide generic lowering and match to other targets.
https://github.com/llvm/llvm-project/pull/101974
More information about the llvm-commits
mailing list