GCC vs Sun CC on SPARC
Eric Botcazou
ebotcazou@libertysurf.fr
Sun Feb 15 10:04:00 GMT 2004
> The results for GCC 3.4pre are pretty encouraging (amazing ?), especially
> in 32-bit mode, but even in 64-bit mode given the larger initial gap. I'm
> going to try to figure out where the difference comes from. Any ideas?
Bottom line: GCC 3.3.2 does something dumb, while GCC 3.4 doesn't do it
anymore and produces code that is structurally very similar to the code
produced by Sun CC.
The profile shows that a single function accounts for 50% of the time spent
in the compression code, and is essentially a big do...while loop. The main
difference between GCC (3.3.2 or 3.4pre) and Sun CC is that GCC rotates
the loop, while Sun CC doesn't. I guess this is sufficient to explain the
2.5% advantage for GCC 3.4pre over Sun CC in 32-bit mode.
GCC 3.3.2 does something weird: there is a conditional continue statement
inside the loop, whose condition is made up of 4 ORed comparisons, each
comparison involving at least one load from memory. The compiler hoists one
of the 4 comparisons before the head condition of the rotated do...while
loop and adds a jump to bypass this latter condition on success, while
redirecting one of the 'while' jumps to the former comparison. So, instead
of a simple loop, we end up with kind of a trampoline in the CFG.
Now trying to figure out why GCC 3.4pre code is still 10% slower than Sun CC
code in 64-bit mode...
--
Eric Botcazou
More information about the Gcc
mailing list