![]() |
Quote:
Quote:
|
Quote:
o Inlining helps more with short strings and unrolling more with long strings. Strings tend to be short thus unrolling may be unnecessary. o Inlining generally gives smaller code than the push/bsr/rts/pop of the AT&T ABI function call so is faster and smaller. Unrolling gives more code which can be bad for ICache usage and wastes memory. Inlining unrolled loops could result in substantially larger program sizes. o String processing is rarely the bottleneck anyway (unless the compiler does an awful job of optimizing string handling :banghead). Quote:
|
Admittedly OT here, but some folks in this thread appear to be the right ones to ask...so.. :)
I've been writing code in C for a long time. However, I'm completely unfamiliar with the assembly it compiles into. Can someone recommend a good online class or reading material to help me learn this? A friend mentioned taking a class at some point whereby they actually wrote a C compiler in assembly, but he did it at his university and as such it isn't available to me. I'd be curious to do something like that. Thanks! |
Quote:
Quote:
|
Quote:
On how a compiler works this might be of help http://compilers.iecc.com/crenshaw/ |
Quote:
Basics of Compiler Design http://www.diku.dk/hjemmesider/ansat...sics_lulu2.pdf It is always good to look at and play with some code too. The vbcc compiler source is fairly modern, advanced, has few dependencies (it compiles on my Amiga) and is written in C. The vbcc source, documentation and binaries are at the following link. http://sun.hasenbraten.de/vbcc/ The GCC C source is available but a complex mess and full of dependencies. Clang/LLVM is written in C++ and has no official or finished 68k backend. The Amiga DICE source is in C and available but it is old and rather basic. It is probably necessary to learn some basic assembly language and study the compiler output to fully understand the process. Various debuggers and disassemblers are available to disassemble compiled programs (ask if needed). The M68000PRM is the basic guide for the 68k ISA (now with spiffy NXP text). http://www.nxp.com/assets/documents/.../M68000PRM.pdf |
Thanks matthey!
|
1 Attachment(s)
Ok, I took the sources from the chess engine TSCP ( http://www.tckerrigan.com/Chess/TSCP/ )
and compiled them with sas/c, gcc and vbcc. Tscp has an embedded benchmark. I lowered the 'max_depth' from 5 to 3, cause you know....amiga. And run the three executables produced from the three compilers. gcc-3.4.0 19 secs sas/c 25secs vbcc 35secs. gcc: m68k-amigaos-gcc -m68020 -O3 -fomit-frame-pointer -noixemul -o tscpgcc *.c vbcc: vc +aos68k -O4 -o tscpvbcc *.c -I/usr/local/amiga/m68k-amigaos/sys-include/ -lmieee -cpu=68020 sas: see scoptions inside archive All the above were run in fs-uae inside a vm so the absolute numbers probably shouldn't mean a thing, still the ratios should be good. Included is the archive of sources, if you want to play with it. You run the executable, type 'bench' and wait. When it's finished type 'bye' to exit. |
Quote:
The examples hello-ks13 and hello-ks20 do compile and run. Bebbo PS and gcc 6 / binutils 2.14 are the default setting now |
Quote:
|
Quote:
Code:
m68k-amigaos-gcc -m68020 -O3 -fomit-frame-pointer -noixemul -o tscpgcc *.c -Xlinker --allow-multiple-definition Bebbo |
Quote:
Bebbo |
Quote:
Btw, thanks for your work. |
Quote:
|
Bebbo, I am still having issues compiling under macOS Sierra. I filed an issue for some common bits I overcame but I'm now getting this:
Code:
: --statistics -o po/zh_TW.gmo /Volumes/Code/amigaos-cross-toolchain/submodules/gcc-6/gcc/po/zh_TW.po |
Quote:
|
Quote:
I'm not sure, but it looks like the target does match your system: Code:
build-i686-linux-gnu Bebbo |
Quote:
without -mregparm=2 the parameters are passed via stack (again): Code:
_strcpy: Bebbo |
Why is it so hard to get compilers to produce proper code for simple stuff like this? It absolutely boggles the mind :confused
|
Quote:
GCC performs the code generation and optimization with abstract instructions. A meta description/som code describes which operations are available, how they perform and how the assembly syntax looks like. If that's not complete or the performance information is bogus, the optimal code can't be found. If the code was still officially supported there were test cases and those bugs were found and fixed. Now: Find and fix it yourself. You are part of the community. Bebbo |
All times are GMT +2. The time now is 22:26. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.