[PATCH] D119121: [test-suite] Add unit tests for vectorizer memory runtime checks.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 7 06:58:44 PST 2022
fhahn added inline comments.
================
Comment at: SingleSource/UnitTests/Vectorizer/runtime-checks.cpp:211
+ {
+ auto ScalarFn = [](auto *A, auto *B, unsigned TC) {
+ unsigned j = 0;
----------------
xbolva00 wrote:
> ```
> template <int F>
> int foo(int *d, int N) {
> int s = 0;
> #pragma unroll F
> for (int i = 0; i < N; ++i) {
> s += d[i];
> }
>
> return s;
> }
>
> int p(int *d, int N) { return foo<2>(d, N); }
> ```
>
>
> Maybe similar idea can be used here? or with _Pragma..
Thanks, I added a macro that generates both `ScalarFn` and `VectorFn`, given a loop body. It uses `_Pragma`. Alternative would be a template + `vectorize_width`, but template lambdas are a bit awkward.
Repository:
rT test-suite
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119121/new/
https://reviews.llvm.org/D119121
More information about the llvm-commits
mailing list