View Single Post
Old 20 January 2017, 11:50   #34
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 48
Posts: 498
Well, with

Code:
m68k-amigaos-gcc -S -O3 strcpy.c -fomit-frame-pointer -funroll-all-loops
it unrolls it 8 times

Code:
_strcpy:
        movel sp@(4),a1
        movel sp@(8),a0
        movel a1,d1
L2:
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jeq L12
        moveb a0@+,d0
        moveb d0,a1@+
        jne L2
        .even
L12:
        movel d1,d0
        rts
I don't understand why the peephole optimiser doesn't convert
Code:
        moveb a0@+,d0
        moveb d0,a1@+
to moveb a0@,a1@ since d0 is dead after, but hey...
alkis is offline  
 
Page generated in 0.04182 seconds with 11 queries