Dead Hackers Society
Other BBSes »
 
 

Silly Venture 2020

Sommarhack 2021
Demoscene  Coding  CT60  Buy/sell

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]

Topic Posted by  Date 
Signs of clang ggn Sep,10.2020-11:59
  Re: Signs of clang PeyloW Sep,15.2020-20:16
    Re: Signs of clang mikro Sep,20.2020-21:37
      Re: Signs of clang ggn Sep,21.2020-22:16
      Re: Signs of clang PeyloW Sep,25.2020-19:24
      Re: Signs of clang PeyloW Sep,25.2020-20:17
        Re: Signs of clang ggn Sep,25.2020-22:29


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

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.
© 1994-2020 Dead Hackers Society Contact: Anders Eriksson