[PATCH] D101844: [MicroBenchmarks] Add initial loop vectorization benchmarks.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 04:09:28 PDT 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LGTM unless others have other comments



================
Comment at: MicroBenchmarks/LoopVectorization/MathFunctions.cpp:11
+template <typename T> static void run_fn_autovec(T *A, T *B, T *C, T (*Fn)(T)) {
+  for (unsigned i = 0; i < N; i++) {
+    C[i] = Fn(A[i]) + Fn(B[i]);
----------------
Sure you don't want the counter to be `int`?


================
Comment at: MicroBenchmarks/LoopVectorization/MathFunctions.cpp:65
+    run_fn_autovec(&A[0], &B[0], &C[0], Fn);
+    benchmark::DoNotOptimize(A);
+    benchmark::DoNotOptimize(B);
----------------
Not really sure if `DoNotOptimize` is enough, maybe you also want `ClobberMemory`


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101844/new/

https://reviews.llvm.org/D101844



More information about the llvm-commits mailing list