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

Jeff Downs heydowns
Fri Sep 10 19:43:26 CEST 2010


On Fri, 10 Sep 2010, M?ns Rullg?rd wrote:

> Jeff Downs <heydowns at somuchpressure.net> writes:
> 
> > As far as I can tell, there is no reliably set macro to indicate that 
> > v8plus is in use on Solaris.
> > SunCC sets a macro (__v8plus or similar, IIRC) but gcc does not emulate 
> > this behavior.
> 
> Bummer.  Is a configure test possible?
> 
> This could be useful to know for other purposes than reading the timer.

Should be, yes. I think it can be as simple as an asm() with your favorite 
v8plus/v9 instruction, as the assembler will reject it when gcc is told to 
target a pre-v9 CPU.  Of course, this is with the Solaris assembler (the 
gcc-preferred assembler on Sparc/Solaris);  someone might want to check 
with a GNU binutils-based toolchain (on Sparc/Linux).


$ echo 'int main() { __asm__("sllx %%g1, 1, %%g1\n\t" ::: "g1"); }' | 
/usr/local/gcc440/bin/gcc -mcpu=v8 -m32 -x c -
/usr/ccs/bin/as: "/var/tmp//ccKwiHyS.s", line 10: error: cannot use v8plus 
instructions in a non-v8plus target binary


However, using -mcpu=v9 instead will compile fine (as it also would with 
-m64):

$ echo 'int main() { __asm__("sllx %%g1, 1, %%g1\n\t" ::: "g1"); }' |
/usr/local/gcc440/bin/gcc -mcpu=v9 -m32 -x c -


BTW - in reality, pretty much any Sparc system running today will support 
these instructions.  Pre-v9 CPUs haven't been sold (by Sun anyway) in 
roughly 15 years afaik. Of course, compilers much more recent than this 
(gcc < 4.2) will still generate code restricted to v8 or prior by default, 
so the configure check is still probably a good idea if we do proceed to 
use v8plus instructions.

	-Jeff



More information about the ffmpeg-devel mailing list