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

--- Comment #59 from Laurent Aflonsi <laurent.alfonsi at st dot com> ---
I have a functional regression due to this improvement when we are compiling
the enclosed example in -O2.
 $ sh-superh-elf-gcc -O2 pr51244-20-main.c pr51244-20.c
 $ sh-superh-elf-run a.out
 FAIL

Thus, the code is transformed from :
  _get_request:
    mov.l    @(12,r4),r1
    tst    r1,r1
    bt    .L2
    mov.l    @(4,r4),r2
    tst    r2,r2
    mov    #-1,r2
     negc    r2,r2
  .L3:
    tst    r2,r2
    bt/s    .L11
    mov    #-100,r0
        mov    #1,r2
        [...]

to : 
  _get_request:
    mov.l    @(12,r4),r1
    tst    r1,r1
    bt    .L2
    mov.l    @(4,r4),r2
    tst    r2,r2
    mov    #-1,r2
    negc    r2,r2
  .L3:
    bf/s    .L11
    mov    #-100,r0
        mov    #1,r2
        [...]

With the inputs encoded in the main function, we are supposed to follow the
simpliest flow (no jump), but when this optimization is enabled, we are jumping
to L11 to to the bt -> bf transfrmation.

Could you please look at it ?

Thanks
Laurent

Reply via email to