Hi, Thanks for pointing this out and providing a nice test case.
The difference seems to be that gcc converts a >> b | a << (64-b) to a ror instruction, whereas Sun Studio leaves it as a bunch of shifts and ors. Regards, Darryl. Joerg Schilling wrote: > Since a longer time, the SunStudio optimizer creates significantly > better optimized code for intel 32 Bit binaries (typically 20%-30% > faster than what GCC creates). > > If you try to create 64 bit binaries, things look different. > > If you e.g. get my recent Schily source consolidation, you will see that > the Reed Solomon Coder and the libmdigest code get slower binaries from > SunStudio. > > Get ftp://ftp.berlios.de/pub/schily/schily-2009-08-12.tar.bz2 > > and call: > > gmake to first create a smake boostrap binary and then use this smake > boostrap to create Sun Studio 32 bit binaries. > > > > then call: > > psmake/smake CCOM=cc64 to create 64 Bit Sun Studio binaries > psmake/smake CCOM=gcc to create 32 Bit GCC binaries > psmake/smake CCOM=gcc64 to create 64 Bit GCC binaries > > Then call: > > mdigest/OBJ/i386-sunos5-cc/mdigest -a sha512 some-file > mdigest/OBJ/i386-sunos5-cc64/mdigest -a sha512 some-file > mdigest/OBJ/i386-sunos5-gcc/mdigest -a sha512 some-file > mdigest/OBJ/i386-sunos5-gcc64/mdigest -a sha512 some-file > > and compare the speed and the user CPU time. > > You may also chdir to "libedc" and call smake -f speed.mk > to create a Reed Solomon speed test..... > > Is there a chance that SunStudio will get better optimization for amd64? > > J?rg >