diff options
author | James Almer <jamrial@gmail.com> | 2017-06-01 18:50:49 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-06-14 19:18:56 -0300 |
commit | 37388b119cf814c2af349e7acba32e33ea30c343 (patch) | |
tree | 59b0cfd8e2c39a3f89f8ca68cbbfc710cf90e11b /tests/checkasm/checkasm.h | |
parent | 12245ab1f677074b8ff83e87f76a41aba692ccd6 (diff) | |
download | ffmpeg-37388b119cf814c2af349e7acba32e33ea30c343.tar.gz |
checkasm: add a checkasm_checked_call function that doesn't issue emms
Meant for DSP functions returning a float or double, as they'd fail if emms
is called after every run on x86_32.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'tests/checkasm/checkasm.h')
-rw-r--r-- | tests/checkasm/checkasm.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 695d871220..03a1eda73e 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -84,6 +84,7 @@ static av_unused void *func_ref, *func_new; /* Declare the function prototype. The first argument is the return value, the remaining * arguments are the function parameters. Naming parameters is optional. */ #define declare_func(ret, ...) declare_new(ret, __VA_ARGS__) typedef ret func_type(__VA_ARGS__) +#define declare_func_float(ret, ...) declare_new_float(ret, __VA_ARGS__) typedef ret func_type(__VA_ARGS__) #define declare_func_emms(cpu_flags, ret, ...) declare_new_emms(cpu_flags, ret, __VA_ARGS__) typedef ret func_type(__VA_ARGS__) /* Indicate that the current test has failed */ @@ -102,6 +103,9 @@ void checkasm_checked_call(void *func, ...); /* Verifies that clobbered callee-saved registers are properly saved and restored * and issues emms for asm functions which are not required to do so */ void checkasm_checked_call_emms(void *func, ...); +/* Verifies that clobbered callee-saved registers are properly saved and restored + * but doesn't issue emms. Meant for dsp functions returning float or double */ +void checkasm_checked_call_float(void *func, ...); #if ARCH_X86_64 /* Evil hack: detect incorrect assumptions that 32-bit ints are zero-extended to 64-bit. @@ -116,6 +120,8 @@ void checkasm_checked_call_emms(void *func, ...); void checkasm_stack_clobber(uint64_t clobber, ...); #define declare_new(ret, ...) ret (*checked_call)(void *, int, int, int, int, int, __VA_ARGS__)\ = (void *)checkasm_checked_call; +#define declare_new_float(ret, ...) ret (*checked_call)(void *, int, int, int, int, int, __VA_ARGS__)\ + = (void *)checkasm_checked_call_float; #define declare_new_emms(cpu_flags, ret, ...) \ ret (*checked_call)(void *, int, int, int, int, int, __VA_ARGS__) = \ ((cpu_flags) & av_get_cpu_flags()) ? (void *)checkasm_checked_call_emms : \ @@ -126,6 +132,7 @@ void checkasm_stack_clobber(uint64_t clobber, ...); checked_call(func_new, 0, 0, 0, 0, 0, __VA_ARGS__)) #elif ARCH_X86_32 #define declare_new(ret, ...) ret (*checked_call)(void *, __VA_ARGS__) = (void *)checkasm_checked_call; +#define declare_new_float(ret, ...) ret (*checked_call)(void *, __VA_ARGS__) = (void *)checkasm_checked_call_float; #define declare_new_emms(cpu_flags, ret, ...) ret (*checked_call)(void *, __VA_ARGS__) = \ ((cpu_flags) & av_get_cpu_flags()) ? (void *)checkasm_checked_call_emms : \ (void *)checkasm_checked_call; @@ -151,6 +158,7 @@ void checkasm_checked_call(void *func, ...); checked_call(func_new, 0, 0, 0, 0, 0, 0, 0, __VA_ARGS__)) #else #define declare_new(ret, ...) +#define declare_new_float(ret, ...) #define declare_new_emms(cpu_flags, ret, ...) /* Call the function */ #define call_new(...) ((func_type *)func_new)(__VA_ARGS__) @@ -159,6 +167,9 @@ void checkasm_checked_call(void *func, ...); #ifndef declare_new_emms #define declare_new_emms(cpu_flags, ret, ...) declare_new(ret, __VA_ARGS__) #endif +#ifndef declare_new_float +#define declare_new_float(ret, ...) declare_new(ret, __VA_ARGS__) +#endif /* Benchmark the function */ #ifdef AV_READ_TIME |