weening@GANG-OF-FOUR.STANFORD.EDU (Joe Weening) (02/05/89)
With GCC 1.33 on a Sun-3 using -O, the program
foo (i)
int i;
{
if (i > 10) return i;
return 10;
}
compiles into:
_foo:
link a6,#0
movel a6@(8),d0
moveq #10,d1
cmpl d0,d1
jge L2
jra L1
L2:
moveq #10,d0
L1:
unlk a6
rts
Version 1.31 of GCC was able to optimize the jumps to:
_foo:
link a6,#0
movel a6@(8),d0
moveq #10,d1
cmpl d0,d1
jlt L1
moveq #10,d0
L1:
unlk a6
rts