[UnitTests/Vectorizer] Add unit tests for find_first_of pattern#333
[UnitTests/Vectorizer] Add unit tests for find_first_of pattern#333
Conversation
This patch adds runtime test cases for vectorization of the
find_first_of idiom:
for (; first != last; ++first)
for (s_it = s_first; s_it != s_last; ++s_it)
if (*first == *s_it)
return first;
return last;
NOTE: this idiom is currently only vectorized by LoopIdiomVectorize,
which is not affected by `#pragma clang loop vectorize(enable)`.
fhahn
left a comment
There was a problem hiding this comment.
NOTE: this idiom is currently only vectorized by LoopIdiomVectorize, which is not affected by #pragma clang loop vectorize(enable).
So doe sthat mean that the current version does not generating a scalar version for ScalarFn?
Yes that is correct - when compiling for AArch64 with +sve2 the There was a bit of discussion here - llvm/llvm-project#179187 (comment) - I'm not sure there's a good way to make the From https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations it doesn't seem obvious to me that the |
|
I think it would make sense for the pragma to apply there as well. |
Agreed - I can look into this and open a PR |
I have added llvm/llvm-project#181142. Also updated this PR to put pragmas on the outer loop, as this makes more sense given that it is the entire nested loop which the vectorization applies to. |
This patch adds runtime test cases for vectorization of the find_first_of idiom:
for (; first != last; ++first)
for (s_it = s_first; s_it != s_last; ++s_it)
if (*first == *s_it)
return first;
return last;
NOTE: this idiom is currently only vectorized by LoopIdiomVectorize, which is not affected by
#pragma clang loop vectorize(enable).