[x265] [PATCH 1 of 3] testbench: support float ret value
Min Chen
chenm003 at 163.com
Fri Apr 25 05:02:09 CEST 2014
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1398394872 -28800
# Node ID 9505724b11bc944eaaefd35d396f92f4c2c3f88f
# Parent c630b0b393eec3a2e2bedf137fba0d56764672ef
testbench: support float ret value
diff -r c630b0b393ee -r 9505724b11bc source/test/checkasm-a.asm
--- a/source/test/checkasm-a.asm Thu Apr 24 15:59:05 2014 -0500
+++ b/source/test/checkasm-a.asm Fri Apr 25 11:01:12 2014 +0800
@@ -87,6 +87,7 @@
;-----------------------------------------------------------------------------
; intptr_t x265_checkasm_call( intptr_t (*func)(), int *ok, ... )
;-----------------------------------------------------------------------------
+cglobal checkasm_call_float
INIT_XMM
cglobal checkasm_call, 2,15,16,max_args*8+8
mov r6, r0
@@ -170,6 +171,7 @@
;-----------------------------------------------------------------------------
; intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... )
;-----------------------------------------------------------------------------
+cglobal checkasm_call_float
cglobal checkasm_call, 1,7
mov r3, n3
mov r4, n4
diff -r c630b0b393ee -r 9505724b11bc source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp Thu Apr 24 15:59:05 2014 -0500
+++ b/source/test/pixelharness.cpp Fri Apr 25 11:01:12 2014 +0800
@@ -915,7 +915,7 @@
int width = (rand() % 4) + 1; // range[1-4]
float cres = ref(sum0, sum1, width);
- float vres = (float)checked(opt, sum0, sum1, width);
+ float vres = (float)checked_float(opt, sum0, sum1, width);
if (fabs(vres - cres) > 0.00001)
return false;
diff -r c630b0b393ee -r 9505724b11bc source/test/testharness.h
--- a/source/test/testharness.h Thu Apr 24 15:59:05 2014 -0500
+++ b/source/test/testharness.h Fri Apr 25 11:01:12 2014 +0800
@@ -121,6 +121,7 @@
/* detect when callee-saved regs aren't saved
* needs an explicit asm check because it only sometimes crashes in normal use. */
intptr_t x265_checkasm_call(intptr_t (*func)(), int *ok, ...);
+float x265_checkasm_call_float(intptr_t (*func)(), int *ok, ...);
#else
#define x265_stack_pagealign( func, align ) func()
#endif
@@ -143,12 +144,21 @@
m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,\
m_rand,m_rand,m_rand,m_rand,m_rand), /* max_args+6 */ \
x265_checkasm_call((intptr_t(*)())func, &m_ok, 0, 0, 0, 0, __VA_ARGS__))
+
+#define checked_float(func,...) ( \
+ m_ok = 1, m_rand = (rand() & 0xffff) * 0x0001000100010001ULL, \
+ x265_checkasm_stack_clobber(m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,\
+ m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,m_rand,\
+ m_rand,m_rand,m_rand,m_rand,m_rand), /* max_args+6 */ \
+ x265_checkasm_call_float((intptr_t(*)())func, &m_ok, 0, 0, 0, 0, __VA_ARGS__))
#define reportfail() if (!m_ok) { fprintf(stderr, "stack clobber check failed at %s:%d", __FILE__, __LINE__); abort(); }
#elif ARCH_X86
#define checked(func,...) x265_checkasm_call((intptr_t(*)())func, &m_ok, __VA_ARGS__);
+#define checked_float(func,...) x265_checkasm_call_float((intptr_t(*)())func, &m_ok, __VA_ARGS__);
#else
#define checked(func,...) func(__VA_ARGS__)
+#define checked_float(func,...) func(__VA_ARGS__)
#define reportfail()
#endif
}
More information about the x265-devel
mailing list