View Single Post
Old 20 January 2017, 10:45   #33
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 43
Posts: 3,088
Quote:
Originally Posted by alkis View Post
Seems like the gcc-3.4.0 produces the most efficient code then, as it avoids saving/restoring a register to stack.
For code this trivial compilers should produce:
Code:
strcpy
    move.l  a0,d0
.loop
    move.b  (a0)+,(a1)+
    bne.s   .loop

    rts
Or better:
Code:
strcpy
    move.l  a0,d0
.loop
    move.b  (a0)+,(a1)+
    beq.s   .end
    move.b  (a0)+,(a1)+
    beq.s   .end
    move.b  (a0)+,(a1)+
    beq.s   .end
    move.b  (a0)+,(a1)+
    bne.s   .loop
.end
    rts
Thorham is offline  
 
Page generated in 0.09247 seconds with 11 queries