[x265] [PATCH 1 of 3] testbench: support float ret value

Steve Borho steve at borho.org
Fri Apr 25 16:41:12 CEST 2014


On Thu, Apr 24, 2014 at 10:02 PM, Min Chen <chenm003 at 163.com> wrote:
> # 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, ...);

I suppose it might be a bit pedantic, but shouldn't the argument
funcdef return a float instead of an intptr_t?

>  #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__))

ditto here and below

>  #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
>  }
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel



-- 
Steve Borho


More information about the x265-devel mailing list