This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve COND_EXPR expansion
- From: "William J. Schmidt" <wschmidt at linux dot vnet dot ibm dot com>
- To: Andrew Pinski <andrew dot pinski at caviumnetworks dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 02 May 2012 07:24:53 -0500
- Subject: Re: [PATCH] Improve COND_EXPR expansion
- References: <CA+=Sn1kp3vxyRdke6=Twe=6KW3uAXY=L9xKJ11iay5MHybBf5w@mail.gmail.com>
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.