Friday July 27, 2007 GCC vs GCCfss vs Studio performance on SPARC
Here is a relative performance chart for several versions of plain GCC including the latest GCC 4.2, just released GCCfss 4.0.4, previous GCCfss 4.0.3, upcoming GCCfss 4.2 and Studio 12 with the most recent patches.
All runs were done on UltraSPARC 4+ box on SPEC CPU2006 FP base with C and C++ benchmarks.

GCC flags:
-O3 -mcpu=ultrasparc3 -funroll-loops -ffast-math -fprefetch-loop-arrays
GCCfss and Studio flags:
-fast -xipo=2 -xpagesize=4M -xprefetch_level=2 -xalias_level=std/layout/compatible
The runs are not SPEC conforming, since Fortran benchmarks were not run, but very representative of any floating point heavy application on SPARC. So consider them an 'estimate'.
Some observations:
We got our next version of GCCfss 4.0.4 available for download here
Main differences vs GCCfss 4.0.3:
Recently went to Rich Oliver's MSF dirt bike school and I should tell you that was a ton of fun! My first ever bike experience was very exciting. Sliding the bike is as much fun as sliding some awd car. Highly recommended.
Posted by alexey ( Apr 13 2007, 01:42:27 PM PDT ) PermalinkUpcoming GCCfss (GCC for Sparc Systems) 4.0.4 is going to relocatable.
While working on building OpenSolaris with gcc4/gccfss I encountered one interesting bug which can be demonstrated by the following simple C program:
void foo (long long *);
void bar (long a, long long b)
{
typeof (a+b) c;
foo (&c);
}
compiled with gcc 3.4 it will print the warning:
$ gcc3 -c simple.c -m64 simple.c: In function `bar': simple.c:6: warning: passing arg 1 of `foo' from incompatible pointer type
whereas gcc 4.x will compile this testcase without any warnings.
The reason for that is GCC 3.x consider 'long + long_long' expression as 'long' type in 64-bit mode which is incorrect.
Why would I care ?
There are multiple places in OpenSolaris where it needs to print 64-bit value and it is done with '%llx' printf specifier. Due to this gcc 3.4 bug the Solaris sources were using '%lx' specifier to print expressions involving long and longlong types and now our changes to compile ON with gcc 4.x would break ON build with /usr/sfw/bin/gcc 3.4 unless the fix can be backported into "csl-sol210-3_4" Solaris specific gcc branch.
All in all, Solaris seems to be overdue to upgrade to some newer version of GCC.
Posted by alexey ( Feb 26 2007, 12:45:09 PM PST ) PermalinkBy working on gcc4/gccfss for OpenSolaris project I found one interesting difference between Studio and GCC compilers.
Studio treats all enumration types in C as signed integers, whereas GCC can put them in unsigned type depending on the values of enumerators.
At first it may look like a minor difference, but in Solaris there was this piece of code:
typedef enum {
A = 0,
B,
C
} en_t;
en_t var;
for (;var >= A; var--);
From GCC point of view the expression "var>=A" is always true, so the loop is collapsed into for(;;) even at -O0 optimization level.
From Studio point of view this code is fine.
Both are correct, because the choice of type is implementation defined by C standard.
One user reported an interesting problem: the same application was giving one result on Ultra III and different result on Ultra IV and Ultra II.
Turned out that some operations on floating point were trapping into the OS on ultra3 and Solaris fp emulator executed them in IEEE compliant way whereas Ultra4 and Ultra2 were executing the same code natively on cpu and because 'non-standard' bit in fsr register was set, Ultra4/2 chips produced different result than Solaris emulation.
Of course this behaviour of Ultra3 is documented, but you really need to be a chip guru to know/remember such details.
That's just something to be aware of if you use floating point a lot
and compile with -ffast-math or -fsimple or -fns flags with GCCfss.
GCCfss 4.0.3 patch update is available
We've just released a patch for GCCfss 4.0.3. It's located at the same place place on SDLC website.
Please download it, remove old 4.0.3 packages and install new 4.0.3 packages.
This patch contains several fixes for the problems reported on the cooltools forum.
You would need to download both packages (SUNW0scgfss and SUNW0gccfss), since the bugfixes went into both.
Please give it a try and send us your feedback. We're constantly working on improving GCCfss and the user feedback makes it even better.
Posted by alexey ( Nov 03 2006, 09:33:58 PM PST ) PermalinkThis year Mazda did yet another zoomzoom event in Alameda,CA. My best laptime in MazdaSpeed6 was 41.546 sec which is 7th overall. Got lucky I guess.
Posted by alexey ( Oct 23 2006, 07:23:59 PM PDT ) PermalinkWe got our next version of GCCfss 4.0.3 available for download here
Main differences vs GCCfss 4.0.2:
This site is a personal blog and is to be used for informational purposes only. The views expressed on this blog are those of the author only, and should not be attributed to any past or present employers.