[Bug target/56309] -O3 optimizer generates conditional moves instead of compare and branch resulting in almost 2x slower code

steven at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 14 22:18:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56309

--- Comment #20 from Steven Bosscher <steven at gcc dot gnu.org> 2013-02-14 22:17:23 UTC ---
(In reply to comment #12)
> --- by-val-O3.s.orig    2013-02-14 18:06:56.000000000 +0100
> +++ by-val-O3.s 2013-02-14 18:07:23.000000000 +0100
> @@ -357,9 +357,8 @@
>         shrq    $32, %rdi
>         cmpq    %r8, %rdx
>         cmovbe  %r11, %rdi
> -       addq    $1, %rax
> -       cmpq    %r8, %rdx
>         cmovbe  %rdx, %rcx
> +       addq    $1, %rax
>         cmpq    %rbp, %rax
>         movq    %rcx, -8(%rsi,%rax,8)
>         jne     .L50
> 
> unmodified: Took 14.31 seconds total.
> modified:   Took 13.04 seconds total.
> 
> So re. comment #9: it's not the problem but it'd be a small improvement.

FWIW this comes from not eliminating the condition expression in
the conditional moves that ifcvt creates:

  tmp_97 = tmp_93 > 4294967295 ? tmp_95 : tmp_93;
  carry_105 = tmp_93 > 4294967295 ? carry_94 : 0;

I'm surprised this form is allowed at all, I'd expect we only allow
is_gimple_reg() for a COND_EXPR_COND in a RHS context.

Anyway -- separate problem.



More information about the Gcc-bugs mailing list