checkasm: Issue emms after benchmarking functions

Message ID 1466506995-62331-1-git-send-email-martin@martin.st
State Committed
Commit dc7501e524dc3270335749302c7aa449973625f3
Headers show

Commit Message

Martin Storsjö June 21, 2016, 11:03 a.m.
The functions may not clean up properly after using MMX
registers. For the normal testing calls, the checkasm_checked_call
functions will do the cleanup (and check that functions that
should clean up do it as well), but when benchmarking functions
that don't clean up, we don't currently properly clean up at all.

This causes issues if a benchmarked function is followed by testing
of a function that is supposed to not clobber the MMX/FPU state but
doesn't touch it at all.
---
 tests/checkasm/checkasm.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Janne Grunau June 21, 2016, 7:04 p.m. | #1
On 2016-06-21 14:03:15 +0300, Martin Storsjö wrote:
> The functions may not clean up properly after using MMX
> registers. For the normal testing calls, the checkasm_checked_call
> functions will do the cleanup (and check that functions that
> should clean up do it as well), but when benchmarking functions
> that don't clean up, we don't currently properly clean up at all.
> 
> This causes issues if a benchmarked function is followed by testing
> of a function that is supposed to not clobber the MMX/FPU state but
> doesn't touch it at all.
> ---
>  tests/checkasm/checkasm.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
> index 619ebc7..0faf3ba 100644
> --- a/tests/checkasm/checkasm.h
> +++ b/tests/checkasm/checkasm.h
> @@ -27,6 +27,7 @@
>  #include "config.h"
>  #include "libavutil/avstring.h"
>  #include "libavutil/cpu.h"
> +#include "libavutil/internal.h"
>  #include "libavutil/lfg.h"
>  #include "libavutil/timer.h"
>  
> @@ -161,6 +162,7 @@ void checkasm_checked_call(void *func, ...);
>                      tcount++;\
>                  }\
>              }\
> +            emms_c();\
>              checkasm_update_bench(tcount, tsum);\
>          }\
>      } while (0)

ok

Janne

Patch

diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 619ebc7..0faf3ba 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -27,6 +27,7 @@ 
 #include "config.h"
 #include "libavutil/avstring.h"
 #include "libavutil/cpu.h"
+#include "libavutil/internal.h"
 #include "libavutil/lfg.h"
 #include "libavutil/timer.h"
 
@@ -161,6 +162,7 @@  void checkasm_checked_call(void *func, ...);
                     tcount++;\
                 }\
             }\
+            emms_c();\
             checkasm_update_bench(tcount, tsum);\
         }\
     } while (0)