------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-09-28 07:14
-------
The remaining oddities, like
srl %o0, 16, %o5
mov 0, %o4
orcc %o4, %o5, %g0
in the V8 code or
srlx %o0, 48, %o1
srlx %o1, 32, %o0
orcc %o0, %o1, %g0
in the V9 code are related to the suboptimal model used for 'long long'
arithmetics on SPARC 32-bit. The code is better on SPARC 64-bit:
FirstOne:
add %sp, -208, %sp
stx %o0, [%sp+2231]
srlx %o0, 48, %o0
brz,pt %o0, .LL2
sethi %lm(first_one), %g4
sethi %hh(first_one), %g1
or %g1, %hm(first_one), %g1
sub %sp, -208, %sp
sllx %g1, 32, %g1
add %g1, %g4, %g1
or %g1, %lo(first_one), %g1
ldub [%g1+%o0], %o0
jmp %o7+8
sra %o0, 0, %o0
.LL2:
lduw [%sp+2231], %o0
sub %sp, -208, %sp
jmp %o7+8
sra %o0, 0, %o0
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16532