[FFmpeg-devel] [PATCH] read_time() for SPARC
Jeff Downs
heydowns
Thu Sep 9 21:52:43 CEST 2010
On Thu, 9 Sep 2010, M?ns Rullg?rd wrote:
> Michael Kostylev <michael.kostylev at gmail.com> writes:
>
> >>
> >>Disassembly of section .text:
> > % gcc -O3 -c sparc.c
> > /tmp/ccdAPwzx.s: Assembler messages:
> > /tmp/ccdAPwzx.s:9: Error: Architecture mismatch on "rd".
> > /tmp/ccdAPwzx.s:9: (Requires v9|v9a|v9b; requested architecture is sparclite.)
> >
> > % gcc -mcpu=v9 -O3 -c sparc.c && objdump -d sparc.o
> >>sparc.o: file format elf32-sparc
> >
> > Disassembly of section .text:
> >
> > 00000000 <foo>:
> > 0: 85 41 00 00 rd %tick, %g2
> > 4: 92 10 00 03 mov %g3, %o1
> > 8: 81 c3 e0 08 retl
> > c: 90 10 00 02 mov %g2, %o0
>
> That is exactly what I'd expect from a 32-bit build that happens to be
> running on a 64-bit machine.
This will yield incorrect results on 32-bit builds. Michael's original
implementation will work properly on any v9 cpu compiled as either 32 or
64-bit binaries when using v8plus isa or higher.
The implementation offered by Mans will only function properly on 64-bit
compilations. This is obviously the optimal implementation for 64-bit
builds.
I see no way to coerce gcc into proper interpretation of the %gX registers
as being able to contain a 64-bit C variable in 32-bit, v8plus, builds;
the "h" constraint doesn't appear to influence this as one might hope.
gcc simply treats the C variable as a register pair on exit of the inline
asm as shown above.
-Jeff
More information about the ffmpeg-devel
mailing list