[x264-devel] [PATCH 3/3] checkasm: arm: Check register clobbering

Martin Storsjö martin at martin.st
Fri Aug 28 08:38:46 CEST 2015


On Thu, 27 Aug 2015, Henrik Gramner wrote:

> On Thu, Aug 27, 2015 at 11:15 PM, Martin Storsjö <martin at martin.st> wrote:
>> Instead of using a separate checkasm_call function for a 64 bit
>> return value, one could also just declare the second one with
>> asm("x264_checkasm_call_neon") to have it map to the same symbol,
>> but I guess it's easier to duplicate than to deal with the
>> potential portability issues.
>
> It should be possible to simply typecast the function pointer inside
> the call_a1_64 macro instead of having separate functions returning
> 64-bit values.
>
> #define call_a1_64(func,...) ((uint64_t (*)((intptr_t(*)(), int,
> ...))x264_checkasm_call)( (intptr_t(*)())func, &ok, __VA_ARGS__ )

I actually did test this originally, but it didn't work; when compiling I 
got the following warning:

tools/checkasm.c: In function 'check_pixel':
tools/checkasm.c:388:30: warning: function called through a non-compatible 
type [enabled by default]
tools/checkasm.c:388:30: note: if this code is reached, the program will 
abort

(And as the warning says, it aborts at runtime.)

However, this was before I changed x264_checkasm_call into a function 
pointer (to be able to distinguish between the neon and noneon versions); 
after that, it works just fine.

So yes, this is doable. But if we'd want to do the same for x86, we'd have 
to change x264_checkasm_call into a function pointer there as well (which 
would require renaming the actual assembly function).

But I guess this at least makes this particular patch quite a bit nicer, 
so I'll resend it with that change.

// Martin


More information about the x264-devel mailing list