https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104987
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If I use --param=logical-op-non-short-circuit=0 -O2 on x86_64-linux, I get
exactly the same -fdump-tree-optimized-alias dump as on v850-elf and the
testcase passes and the optimized dump looks sane.
I admit I don't have v850-elf binutils nor sim around, but the assembly I get
is:
_foo_mult:
.LFB0:
prepare {r31}, 0
movea -20,r0,r10
cmp r10,r6
blt .L2
cmp -9,r6
blt .L14
cmp 10,r6
bgt .L7
cmp 1,r7
bgt .L4
addi 10,r7,r10
cmp 8,r10
bh .L2
.L12:
mov r6,r10
mul r7,r10,r0
dispose 0 {r31}, r31
...
.L2:
jarl _abort, r31
When this is called, r6 is 10 and r7 is -2, so I think none of the conditional
jumps should branch away,
because r6 >= -20, r6 >= -9, r6 <= 10, r7 <= 1 and so it will do r10 = r7 + 10
(thus set r10 to 8) and r10 <= 8U,
so I think it should fall through into .L12 and multiply + return.