Commit Graph

22 Commits

Author SHA1 Message Date
Anton Khirnov 0cef06df07 checkasm: add HEVC MC tests 2015-12-05 21:11:21 +01:00
Henrik Gramner 8bb376cf6b checkasm: Fix the function name sorting algorithm
The previous implementation was behaving incorrectly in some corner cases.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-10-03 13:38:03 +02:00
Henrik Gramner cc28552100 checkasm/x86: Correctly handle variadic functions
The System V ABI on x86-64 specifies that the al register contains an upper
bound of the number of arguments passed in vector registers when calling
variadic functions, so we aren't allowed to clobber it.

checkasm_fail_func() is a variadic function so also zero al before calling it.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-09-28 14:25:59 +02:00
Henrik Gramner 5405584b7b checkasm: Use a self-balancing tree
Tested functions are internally kept in a binary search tree for efficient
lookups. The downside of the current implementation is that the tree quickly
becomes unbalanced which causes an unneccessary amount of comparisons between
nodes. Improve this by changing the tree into a self-balancing left-leaning
red-black tree with a worst case lookup/insertion time complexity of O(log n).

Significantly reduces the recursion depth and makes the tests run around 10%
faster overall. The relative performance improvement compared to the existing
non-balanced tree will also most likely increase as more tests are added.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-09-28 11:16:33 +02:00
Henrik Gramner 781a25e9c4 checkasm: v210: Fix array overwrite 2015-09-17 10:33:06 +02:00
Henrik Gramner 3cdda78deb checkasm: add unit tests for v210enc
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-09-06 10:36:24 +02:00
Henrik Gramner c457bdebe7 checkasm: Fix floating point arguments on 64-bit Windows
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-08-28 09:54:54 +02:00
Henrik Gramner 515b69f8f8 checkasm: Explicitly declare function prototypes
Now we no longer have to rely on function pointers intentionally
declared without specified argument types.

This makes it easier to support functions with floating point parameters
or return values as well as functions returning 64-bit values on 32-bit
architectures. It also avoids having to explicitly cast strides to
ptrdiff_t for example.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-08-20 19:22:34 +02:00
Henrik Gramner e13da244f4 checkasm: x86: properly save rdx/edx in checked_call()
If the return value doesn't fit in a single register rdx/edx can in some
cases be used in addition to rax/eax.

Doesn't affect any of the existing checkasm tests but might be useful later.

Also comment the relevant code a bit better.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-08-20 19:22:06 +02:00
Henrik Gramner 8f4a06faf4 checkasm: Remove unnecessary include
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-08-11 11:00:53 +02:00
Martin Storsjö bf0cef5c3a checkasm: Include io.h for isatty, if available
configure does check for isatty, and checkasm properly checks
HAVE_ISATTY, but on some platforms (e.g. WinRT), io.h needs to be
included for isatty to be available.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-07-30 09:27:09 +03:00
Henrik Gramner 65c1480152 checkasm: Modify report format
Makes it a bit more clear where each test belongs.

Suggested by Anton Khirnov.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-07-27 07:45:11 +02:00
Michael Niedermayer 4d0d55cd62 checkasm: Use LOCAL_ALIGNED
Fixes alignment issues and bus errors.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-07-26 10:36:22 +03:00
Janne Grunau e605bf3b59 checkasm: remove empty array initializer list in h264pred test
Fixes MSVC compilation.
2015-07-22 12:06:32 +02:00
Luca Barbato 3ae0e721c7 checkasm: Always link statically
Checkasm needs to use internal symbols that should not be made public.
2015-07-21 23:22:42 +02:00
Janne Grunau 82e6ac85ff checkasm: test all architectures with optimisations 2015-07-18 01:06:45 +02:00
Michael Niedermayer cb33f8d0f4 checkasm: Give macro a body to avoid potential unexpected syntax issues 2015-07-18 01:06:44 +02:00
Henrik Gramner 6cc4d3e9a9 checkasm: exit with status 0 instead of 1 if there are no tests to perform 2015-07-18 01:06:44 +02:00
Luca Barbato fc56868399 cosmetics: Reformat checkasm tests 2015-07-17 21:29:20 +02:00
Henrik Gramner d37f232635 checkasm: Add unit tests for bswapdsp
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-07-17 20:03:55 +02:00
Henrik Gramner 2cb34f82b9 checkasm: Add unit tests for h264qpel
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-07-15 19:47:07 +02:00
Henrik Gramner 8bc67ec2c0 Checkasm: assembly testing and benchmarking tool
It provides the following features:
 * verify correctness by comparing output to the C version.
 * detect failure to save and restore clobbered callee-saved registers.
 * detect 32-bit parameters being used as if they were 64-bit in x86-64
   (the upper halves are not guaranteed to be zero - but in practice
   they very often are, which makes those bugs hard to spot otherwise).
 * easy benchmarking.

Compile by running 'make checkasm'.
Execute by running 'tests/checkasm/checkasm'.

Optional arguments are '--bench' to run benchmarks for all functions,
'--bench=<pattern>' to run benchmarks for all functions that starts with
<pattern>, and '<integer>' to seed the PRNG for reproducible results.

Contains unit tests for most h264pred functions to get started, more tests
can be added afterwards using those as a reference.

Loosely based on code from x264. Currently only supports x86 and x86-64,
but additional architectures shouldn't be too much of an obstacle to add.

Note that functions with floating point parameters or floating point
return values are not supported. Some compiler-specific features or
preprocessor hacks would likely be required to add support for that.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2015-07-12 16:39:07 +02:00