[PATCH] Improve COND_EXPR expansion

William J. Schmidt wschmidt@linux.vnet.ibm.com
Wed May 2 12:25:00 GMT 2012


On Mon, 2012-04-30 at 20:22 -0700, Andrew Pinski wrote:
> Hi,
>   This patch improves the expansion of COND_EXPR into RTL, directly
> using conditional moves.
> I had to fix a bug in the x86 backend where emit_conditional_move
> could cause a crash as we had a comparison mode of DImode which is not
> handled by the 32bit part.  can_conditionally_move_p return true as we
> had an SImode for the other operands.
> Note other targets might need a similar fix as x86 had but I could not
> test those targets and this is really the first time where
> emit_conditional_move is being called with different modes for the
> comparison and the other operands mode and the comparison mode is not
> of the CC class.

Hi Andrew,

I verified your patch on powerpc64-unknown-linux-gnu.  There were no new
testcase regressions, and SPEC cpu2006 built ok with your changes.

Hope this helps!

Bill
> 
> The main reasoning to do this conversion early rather than wait for
> ifconv as the resulting code is slightly better.  Also the compiler is
> slightly faster.
> 
> OK?  Bootstrapped and tested on both mips64-linux-gnu (where it was
> originally written for) and x86_64-linux-gnu.
> 
> Thanks,
> Andrew Pinski
> 
> ChangeLog:
> * expr.c (convert_tree_comp_to_rtx): New function.
> (expand_expr_real_2): Try using conditional moves for COND_EXPRs if they exist.
> * config/i386/i386.c (ix86_expand_int_movcc): Disallow comparison
> modes of DImode for 32bits and TImode.



More information about the Gcc-patches mailing list