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

--- Comment #2 from Oleg Endo <oleg.e...@t-online.de> 2011-12-27 21:26:33 UTC 
---
(In reply to comment #1)
> 
> BTW, OT, (a != b || a != c) ? b : c could be reduced to b, I think.
> 

Yes, very much so.
It is reduced to "return b" for -m2, -m2e, -m2a, -m3, -m3e
but not for -m1 and -m4*.

The correct test function should be rather:

int test_func_0_NG (int a, int b, int c, int d)
{
  return (a != b || a != d) ? b : c;
}

which is actually OK for all variants except -m1 and -m4*:

    cmp/eq    r5,r4    ! 11    cmpeqsi_t/3    [length = 2]
    bf.s    .L6    ! 12    branch_false    [length = 2]
    cmp/eq    r7,r5    ! 14    cmpeqsi_t/3    [length = 2]
    bf    .L6    ! 15    branch_false    [length = 2]
    mov    r6,r5    ! 8    movsi_i/2    [length = 2]
.L6:
    rts        ! 42    *return_i    [length = 2]
    mov    r5,r0    ! 23    movsi_i/2    [length = 2]

Reply via email to