https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69569

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-08-21
          Component|rtl-optimization            |tree-optimization
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is optimized for -O2 and above on aarch64-linux-gnu just fine:
For GCC 7:
baz:
        cmp     w0, 2
        bgt     .L1
        bne     .L1
        b       foo
        .p2align 3
.L1:
        mov     w0, 77
        ret
--- CUT ----
For GCC 5.4:
baz:
        cmp     w0, 2
        ble     .L7
.L2:
        mov     w0, 77
        ret
        .p2align 3
.L7:
        bne     .L2
        b       foo

---- CUT ----

I suspect the issue for -O1 is that we don't change the switch into an if
statement when we only have two cases.

Reply via email to