Code:
int f(void *a, int b)
{
if (b ==1) goto *a;
g();
if (b ==2) goto *a;
g();
return 1
}
This is very minor but I thought it would be cool if GCC could do something
like:
.f:
mflr %r0
cmpwi %cr7,%r4,1
std %r30,-16(%r1)
std %r31,-8(%r1)
mr %r30,%r3
mr %r31,%r4
std %r0,16(%r1)
stdu %r1,-128(%r1)
mtctr %r30
beqctr %cr7,.L3
bl .g
nop
cmpwi %cr7,%r31,2
mtctr %r30
beqctr %cr7,.L3
bl .g
li %r3
blr
.L3:
mtctr %r30
bctr
--
Summary: PPC has conditional indirect jumps if ra allocates the a
in ctr before the jumps
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25287