https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With:
--- ifcvt.c.jj2 2017-01-23 18:09:45.000000000 +0100
+++ ifcvt.c 2017-02-22 14:25:15.758296571 +0100
@@ -777,6 +777,9 @@ struct noce_if_info
/* The jump condition. */
rtx cond;
+ /* Reversed jump condition. */
+ rtx rev_cond;
+
/* New insns should be inserted before this one. */
rtx_insn *cond_earliest;
@@ -898,7 +901,7 @@ noce_emit_store_flag (struct noce_if_inf
&& (normalize == 0 || STORE_FLAG_VALUE == normalize))
{
rtx src = gen_rtx_fmt_ee (code, GET_MODE (x), XEXP (cond, 0),
- XEXP (cond, 1));
+ XEXP (cond, 1));
rtx set = gen_rtx_SET (x, src);
start_sequence ();
@@ -1553,11 +1556,10 @@ noce_try_addcc (struct noce_if_info *if_
if (GET_CODE (if_info->a) == PLUS
&& rtx_equal_p (XEXP (if_info->a, 0), if_info->b)
- && (reversed_comparison_code (if_info->cond, if_info->jump)
- != UNKNOWN))
+ && if_info->rev_cond)
{
- rtx cond = if_info->cond;
- enum rtx_code code = reversed_comparison_code (cond, if_info->jump);
+ rtx cond = if_info->rev_cond;
+ enum rtx_code code = GET_CODE (cond);
/* First try to use addcc pattern. */
if (general_operand (XEXP (cond, 0), VOIDmode)
@@ -4064,6 +4066,11 @@ noce_find_if_block (basic_block test_bb,
if_info.else_bb = else_bb;
if_info.join_bb = join_bb;
if_info.cond = cond;
+ rtx_insn *rev_cond_earliest;
+ if_info.rev_cond = noce_get_condition (jump, &rev_cond_earliest,
+ !then_else_reversed);
+ gcc_assert (if_info.rev_cond == NULL_RTX
+ || rev_cond_earliest == cond_earliest);
if_info.cond_earliest = cond_earliest;
if_info.jump = jump;
if_info.then_else_reversed = then_else_reversed;
I get:
comisd %xmm1, %xmm2
sbbl $-1, %ebp
instead of:
leal 1(%rbx), %eax
...
comisd %xmm1, %xmm2
cmovnb %eax, %ebx
(plus slightly different RA).