|
Atari demoscene BBS
Re: Signs of clang |
Posted by: PeyloW
|
Sep,25.2020-19:24
|
Sure thing, compiling this with -m68000 -Os -fomit-frame-pointer;
short test(short num) {
if (num > 0)
return num + num;
else
return num * num;
}
GCC 4.64
test(short):
move.w 6(%sp),%d0
jle .L2
lsl.w #1,%d0
rts
.L2:
muls.w %d0,%d0
rts
GCC 7.20, and 9.3.0
test(short):
move.l 4(%sp),%d0
tst.w %d0 ; NO!!
jle .L2
lsl.w #1,%d0
.L1:
rts
.L2:
muls.w %d0,%d0
jra .L1 ; WHY?
6.20 is the last one using rts directly in else clause, when using -Os. By Using -O2 the arts is kept, but the test any many other optimizations go away.
This is a tiny example, I mostly use the assembly from libcmini and my own game, to judge.
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|