I was looking at some code generation for an internal benchmark when I noticed this. With the current trunk on powerpc, we get a mfcr which is slow for the cell (and most likely other PPCs too) as we pulled too many cmps with some loops. A simple example: int f(int b, int l, int d, int c, int e) { int i = 0; for(i = 0;i< l;i ++) { if (b) g(); if (c) g(); if (d) g(); if (e) g(); } }
Note this is not a regression as loop.c did the same.
While looking a different bug dealing with invariant motion, I noticed that estimate_reg_pressure_cost does not take into account the mode of the new register. This seems like a big issue. Also init_set_costs always uses SImode which is not a good representation of the register pressure in general.
Still happens on the trunk.
Can you post the output .s of gcc, and the .s you expect?
It is pretty obvious from doing a cross build. We get a couple sets of: lwz 0,112(1) rlwinm 0,0,4,0xffffffff mtcrf 1,0 rlwinm 0,0,28,0xffffffff beq 7,.L6 Which loads r0 from the stack and then puts it into a conditional register and the branches. Note the rlwinm's are there to shift the registers around to put it into the correct location for the mtcrf.
Oh wow. ... Still happens with trunk. Confirmed.
I Notice LLVM does similarly on this testcase too.