[PATCH] ppc-darwin -mdynamic-no-pic improvement

Andrew Pinski pinskia@physics.uc.edu
Tue Aug 9 19:50:00 GMT 2005


On Aug 9, 2005, at 3:45 PM, Andrew Pinski wrote:

> While looking into code generation while compiling GCC, I noticed that 
> we miss a
> CSE opportunity because we did not separate the low and high parts out.
>
> This should improve code generation on ppc-darrwin with 
> -mdynamic-no-pic a little
> (which is used when compiling GCC already).  This should also improve 
> SPEC but
> since I don't have access to SPEC, I cannot test it.
>
> OK? Bootstrapped and tested on powerpc-darwin7.9.0 with no regressions.

Oh, I forgot to show the improvement.
Take the following testcase:
int curr_state_graph_pass_num = 0;
void
pass_states (void)
{
   curr_state_graph_pass_num++;
}

Currently on the mainline, we produce (with -O2 -mdynamic-no-pic):
         lis r9,ha16(_curr_state_graph_pass_num)
         la r9,lo16(_curr_state_graph_pass_num)(r9)
         lwz r2,0(r9)
         addi r2,r2,1
         stw r2,0(r9)
         blr

But that is not optimal, with the patch I get:
         lis r9,ha16(_curr_state_graph_pass_num)
         lwz r2,lo16(_curr_state_graph_pass_num)(r9)
         addi r2,r2,1
         stw r2,lo16(_curr_state_graph_pass_num)(r9)
         blr

Which is much better.

-- Pinski



More information about the Gcc-patches mailing list