This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Try to expand COND_EXPR using addcc


Hi,
  This is just like my previous patch to expand COND_EXPR using
conditional moves but this time using addcc instead.
I had to fix a bug in emit_conditional_add where it was swapping op2
and op3 which can never happen.  Also the documentation for both
emit_conditional_add and add@var{mode}cc was in correct in saying the
first (non comparison) operand was the result when the condition was
true, it should have been when it was false.  So it does op2 if cond
is false and op2+op3 when the cond is true.  This actually makes
better sense than what the documentation was before too.

OK? Bootstrapped and tested on x86_64-linux-gnu?

Thanks,
Andrew Pinski

ChangeLog:
 * optabs.c (emit_conditional_add): Correct comment about the arguments.
Remove code which might swap op2 and op3 since they cannot be swapped.
* expr.c (get_condition_from_operand): New function.
(get_def_noter_for_expr_with_code): New function.
(expand_cond_expr_using_addcc): New function.
(expand_cond_expr_using_cmove): Use get_condition_from_operand instead
of doing it inline.
(expand_expr_real_2 <case COND_EXPR>): Call
expand_cond_expr_using_addcc before trying conditional moves.
* doc/md.texi (add@var{mode}cc): Fix document about how the arguments are used.

Attachment: add_cond_expr_addcc_expanding.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]