shithub: dav1d

Download patch

ref: efd852af30ff160ecea04674713d9810c5370644
parent: f6024104004b13f65486a62d2623c550953b757e
author: Luca Barbato <lu_zero@gentoo.org>
date: Tue Jun 4 05:50:55 EDT 2019

checkasm: Add an option to benchmark the C code as well

--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -138,6 +138,7 @@
     const char *cpu_flag_name;
     const char *test_name;
     unsigned int seed;
+    int bench_c;
 } state;
 
 /* float compare support code */
@@ -344,7 +345,7 @@
         print_benchs(f->child[0]);
 
         /* Only print functions with at least one assembly version */
-        if (f->versions.cpu || f->versions.next) {
+        if (state.bench_c || f->versions.cpu || f->versions.next) {
             const CheckasmFuncVersion *v = &f->versions;
             do {
                 if (v->iterations) {
@@ -512,7 +513,10 @@
                     "    --test=<test_name>  Test only <test_name>\n"
                     "    --bench=<pattern>   Test and benchmark the functions matching <pattern>\n"
                     "    --list              List the available tests\n"
+                    "    --bench-c           Benchmark the C-only functions\n");
             return 0;
+        } else if (!strncmp(argv[1], "--bench-c", 9)) {
+            state.bench_c = 1;
         } else if (!strncmp(argv[1], "--bench", 7)) {
 #ifndef readtime
             fprintf(stderr,
@@ -608,7 +612,7 @@
     state.current_func_ver = v;
     xor128_srand(state.seed);
 
-    if (state.cpu_flag)
+    if (state.cpu_flag || state.bench_c)
         state.num_checked++;
 
     return ref;