[FFmpeg-devel] [PATCH] read_time() for SPARC

Måns Rullgård mans
Fri Sep 10 09:59:27 CEST 2010


Michael Kostylev <michael.kostylev at gmail.com> writes:

> On Thu Sep  9 22:01:44 2010
> M?ns Rullg?rd wrote:
>
>>> if the only issue left is the sometimes unneeded stx instruction
>>> then i approve the patch with this. If there are other issues they
>>> of course have to be fixed first
>>
>>Apparently the ifdef test in the patch is not reliable.
>
> Redone.
>
> Michael
>
> +#ifndef AVUTIL_SPARC_TIMER_H
> +#define AVUTIL_SPARC_TIMER_H
> +
> +#if defined(__arch64__) || defined(__sparc_v9__)

I'm still not convinced this is right:

$ sparc-unknown-linux-gnu-gcc -m32 -mcpu=v9 -mno-v8plus -dM -E -xc /dev/null | grep -E 'arch|sparc'
#define sparc 1
#define __sparc__ 1
#define __sparc 1
#define __sparc_v9__ 1

> +#include <stdint.h>
> +
> +#define AV_READ_TIME read_time
> +
> +static inline uint64_t read_time(void)
> +{
> +    uint64_t tc;
> +
> +#ifdef __arch64__
> +    __asm__ volatile("rd %%tick,%0" : "=r" (tc));
> +#else
> +    __asm__ volatile("rd %%tick,%%g1\n\t"
> +                     "stx %%g1,%0"
> +                     : "=m" (tc) :: "g1");
> +#endif /* __arch64__ */
> +
> +    return tc;
> +}

Now that wasn't so hard, was it?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list