![]() |
Quote:
You need the patched binutil-2.14 which is in the toolchain: Code:
./toolchain-m68k --gcc 6 --binutils 2.14 Bebbo |
Can we see some generated code?
For reference here is a small function strcpy.c Code:
char *strcpy(char *dst, const char *src) { Code:
m68k-amigaos-gcc -fno-builtin -S strcpy.c -c -fverbose-asm -fomit-frame-pointer -O3 Code:
_strcpy: Code:
strcpy: Thanks. |
I don't have libnix built yet but GCC 6.2.1 produces this:
Code:
_strcpy: |
Quote:
The code is flawed of course (as usual with GCC) and should probably be the following using register arguments as above with a0=dst a1=src (inlining would be better where possible). Code:
_strcpy: |
Quote:
|
Quote:
Quote:
|
Quote:
Or...what code does your favorite amiga c compiler produces??? |
Quote:
Quote:
Code:
move.l a0,d0 Code:
strcpy: |
Wow, that's bad. I don't think even old compilers like SAS/C produce that kind of code. Just wow :rolleyes
I certainly know which compiler to avoid now. What a shame :( |
Quote:
|
At least that means SAS/C isn't useless ;)
Here's what SAS/C produces, for those who are interested. Code:
SECTION text,CODE |
Seems like the gcc-3.4.0 produces the most efficient code then, as it avoids saving/restoring a register to stack.
|
Quote:
Code:
strcpy Code:
strcpy |
Well, with
Code:
m68k-amigaos-gcc -S -O3 strcpy.c -fomit-frame-pointer -funroll-all-loops Code:
_strcpy: Code:
moveb a0@+,d0 |
not that i understand much but for the sake of it, results of both aros68k compilers im currently using:
strcpy: move.l 4(%sp),%d0 | dst, dst move.l 8(%sp),%a1 | src, src move.l %d0,%a0 | dst, ivtmp.11 .L2: move.b (%a1)+,%d1 | MEM[base: src_8, offset: 4294967295B], _9 move.b %d1,(%a0)+ | _9, MEM[base: _14, offset: 0B] jne .L2 | rts .size strcpy, .-strcpy .ident "GCC: (GNU) 6.1.0" strcpy: move.l 4(%sp),%d0 | dst, dst move.l 8(%sp),%a1 | src, ivtmp.9 move.l %d0,%a0 | dst, dst .L2: move.b (%a1)+,%d1 | MEM[base: D.779_19, offset: 0B], D.759 move.b %d1,(%a0)+ | D.759, MEM[base: dst_1, offset: 0B] jne .L2 | rts .size strcpy, .-strcpy .ident "GCC: (GNU) 4.6.4" |
Quote:
Code:
strcpy |
Quote:
|
Quote:
|
Quote:
Quote:
Quote:
Quote:
|
Quote:
Quote:
@wawa The aros68k GCC compiler is doing a good job here. It should be able to merge 2 lines inside the loop but overall good. Quote:
Code:
char *strcpy(char *dst, const char *src); Code:
char *stpcpy(char *dst, const char *src); |
All times are GMT +2. The time now is 02:47. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.