English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 02 February 2017, 11:25   #61
wXR
Registered User
 
Join Date: Mar 2009
Location: New York
Posts: 552
In your face, Thorham!

Nah, just kidding. But I love this thread.
wXR is offline  
AdSense AdSense  
Old 03 February 2017, 06:03   #62
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 396
I got this sort of working and then went a bit crazy and hacked it to produce VASM compatible assembler output.

I then used to it compile my new work in progress game (developed using vbcc and vasm). This was pretty easy as my game is 68000 only with purely integer math, so I didn't need any support libraries/GCC builtins etc to work.

Measuring the number of scan lines my game currently takes to calculate/render a basic frame:

vbcc: 78
gcc6/vasm: 68

And considering that a large chunk of that time is spent waiting for the blitter, I think it indicates that gcc has the potential to be quite a bit faster.

Unfortunately there are glitches in the GCC compiled version, so I need to decide if I have the stamina to work out what's causing them.
alpine9000 is online now  
Old 04 February 2017, 05:15   #63
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 396
Quote:
Originally Posted by alpine9000 View Post
I got this sort of working and then went a bit crazy and hacked it to produce VASM compatible assembler output.

I then used to it compile my new work in progress game (developed using vbcc and vasm). This was pretty easy as my game is 68000 only with purely integer math, so I didn't need any support libraries/GCC builtins etc to work.

Measuring the number of scan lines my game currently takes to calculate/render a basic frame:

vbcc: 78
gcc6/vasm: 68

And considering that a large chunk of that time is spent waiting for the blitter, I think it indicates that gcc has the potential to be quite a bit faster.

Unfortunately there are glitches in the GCC compiled version, so I need to decide if I have the stamina to work out what's causing them.
So I got my game fully working with gcc6.2. Funnily enough most of the issues were actually bugs in my game that just didn't cause issues with vbcc.

There was one change I needed to make in gcc:

__asm("XX") arguments in calls to externally defined functions were not being correctly assigned to the specified registers (which obviously made interfacing to my existing asm hard).

I fixed it with a small change to gcc/config/m68k/amigaos.c:amigaos_function_arg

Code:
-  tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
+ tree asmtree = type ? TYPE_ATTRIBUTES(TREE_VALUE(cum->formal_type)) : NULL_TREE;
Not sure if this is correct, but it seems to work.

So far I am loving using gcc with vasm.

Last edited by alpine9000; 04 February 2017 at 05:35.
alpine9000 is online now  
Old 04 February 2017, 09:35   #64
Thorham
Computer Nerd

Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 41
Posts: 2,971
Quote:
Originally Posted by bebbo View Post
Now: Find and fix it yourself. You are part of the community.
I was just asking why compilers produce crappy code for simple things like this, I wasn't complaining about why no one fixes it

Anyway, I'm certainly not fixing it, because I have no need for it, and wouldn't have a clue of where to start if I did want to fix it.

For what little C is use on the Amiga, I use SAS/C, and that works perfectly fine. For everything else I use assembly language.

Quote:
Originally Posted by wXR View Post
In your face, Thorham!
Thorham is offline  
Old 04 February 2017, 16:20   #65
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by alpine9000 View Post
I got this sort of working and then went a bit crazy and hacked it to produce VASM compatible assembler output.

I then used to it compile my new work in progress game (developed using vbcc and vasm). This was pretty easy as my game is 68000 only with purely integer math, so I didn't need any support libraries/GCC builtins etc to work.
Did you change the GCC output to accept Mototola syntax? Vasm is supposed to accept AT&T syntax but it was more of a work in progress lacking enough testing. Did you use vlink to produce Amiga hunk format?

Quote:
Originally Posted by alpine9000 View Post
Measuring the number of scan lines my game currently takes to calculate/render a basic frame:

vbcc: 78
gcc6/vasm: 68

And considering that a large chunk of that time is spent waiting for the blitter, I think it indicates that gcc has the potential to be quite a bit faster.
How much performance and code size difference is there between gcc6/vasm and gcc6/gas? It is sad that vbcc code generation quality has declined recently. Supposedly there have been some minor fixes for loops since the vbcc 0.9e release which would require requesting the source and re-compiling (there are newer source only versions of vasm available too). Did you test with the original vbcc 0.9e release?
matthey is offline  
Old 05 February 2017, 00:16   #66
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 396
Quote:
Originally Posted by matthey View Post
Did you change the GCC output to accept Mototola syntax? Vasm is supposed to accept AT&T syntax but it was more of a work in progress lacking enough testing. Did you use vlink to produce Amiga hunk format?
I saw that vbcc has a "-gas" option, but I really prefer the standard mot/vasm syntax and tend to use the generated assembler as a starting point for converting critical stuff to pure asm, so I wanted it to be normal mot syntax.

Yes, I use vlink to create hunk files. However my code doesn't need any external C libraries so that makes things easier for me. The compiler couldn't build hello.c at the moment.

Quote:
Originally Posted by matthey View Post
How much performance and code size difference is there between gcc6/vasm and gcc6/gas? It is sad that vbcc code generation quality has declined recently. Supposedly there have been some minor fixes for loops since the vbcc 0.9e release which would require requesting the source and re-compiling (there are newer source only versions of vasm available too). Did you test with the original vbcc 0.9e release?
I didn't get my game working with gas. Re code size, the game is slightly larger with GCC compared to VBCC (like 500 bytes out of 500kb).

I tried the latest vbcc source snapshot and it wasn't any different.
alpine9000 is online now  
Old 05 February 2017, 05:28   #67
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by alpine9000 View Post
I saw that vbcc has a "-gas" option, but I really prefer the standard mot/vasm syntax and tend to use the generated assembler as a starting point for converting critical stuff to pure asm, so I wanted it to be normal mot syntax.
I think we all prefer the relaxed vasm Motorola syntax .

Quote:
Originally Posted by alpine9000 View Post
Yes, I use vlink to create hunk files. However my code doesn't need any external C libraries so that makes things easier for me. The compiler couldn't build hello.c at the moment.
It would probably be more work to replace GCC's linker with vlink than GAS with vasm but it would be nice.

Quote:
Originally Posted by alpine9000 View Post
I didn't get my game working with gas. Re code size, the game is slightly larger with GCC compared to VBCC (like 500 bytes out of 500kb).

I tried the latest vbcc source snapshot and it wasn't any different.
matthey is offline  
Old 05 February 2017, 05:52   #68
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 396
Quote:
Originally Posted by matthey View Post
It would probably be more work to replace GCC's linker with vlink than GAS with vasm but it would be nice.
It's easy to make gcc use vlink, but it's probably hard to get a working set of startup/C libraries that works with that configuration.

I wrote a simple OS for SH-2e and most of the effort was spent in getting the C library (newlib) working.

It might be possible to build bebbo's fork of libnix using a VASM version of GCC but I have no confidence in my gcc port yet and no need for a C library.
alpine9000 is online now  
Old 12 February 2017, 13:57   #69
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 179
I pushed some further changes:

* toolchain build is running until it hits libstd++-v3
* hello-stdio.c, hello-ks13.c and hello-ks20.c can be compiled and linked, and are running, you'll need "stack 50000" before running the clib2 versions!

next todos:
=> the linker is maybe still bogus
=> libstd++-v3 needs support for its exception table segments

Have fun and waste your time^^

Bebbo

Last edited by bebbo; 13 February 2017 at 09:36. Reason: updated: clib2 hellos are working too
bebbo is offline  
Old 13 February 2017, 20:09   #70
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 179
Quote:
Originally Posted by alkis View Post
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.
This chess program / benchmark is working now:

Code:
m68k-amigaos-gcc -m68020 -O3 -fomit-frame-pointer -noixemul -o tscpgcc6 *.c -Xlinker --allow-multiple-definition
And here are my results:

Code:
tscpvbcc:  4540ms
tscpsc:    3860ms
tscpgcc:   3160ms
tscpgcc6:  2780ms
Bebbo
bebbo is offline  
Old 13 February 2017, 20:36   #71
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 396
Quote:
Originally Posted by bebbo View Post
This chess program / benchmark is working now:

Code:
m68k-amigaos-gcc -m68020 -O3 -fomit-frame-pointer -noixemul -o tscpgcc6 *.c -Xlinker --allow-multiple-definition
And here are my results:

Code:
tscpvbcc:  4540ms
tscpsc:    3860ms
tscpgcc:   3160ms
tscpgcc6:  2780ms
Bebbo
Thanks for your effort on this.

Keep up the good work!
alpine9000 is online now  
Old 13 February 2017, 22:14   #72
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 379
Quote:
Originally Posted by bebbo View Post
This chess program / benchmark is working now:

Code:
m68k-amigaos-gcc -m68020 -O3 -fomit-frame-pointer -noixemul -o tscpgcc6 *.c -Xlinker --allow-multiple-definition
And here are my results:

Code:
tscpvbcc:  4540ms
tscpsc:    3860ms
tscpgcc:   3160ms
tscpgcc6:  2780ms
Bebbo
Niiiiice!
alkis is online now  
Old 14 February 2017, 15:10   #73
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 893
does that mean that gcc6 is about one third faster than gcc3 and almost twice as fast as vbcc? hmm..
wawa is offline  
Old 14 February 2017, 15:37   #74
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 179
Quote:
Originally Posted by wawa View Post
does that mean that gcc6 is about one third faster than gcc3 and almost twice as fast as vbcc? hmm..
Looks like 12% faster than older gcc and 39% vs vbcc.

I don't know exactly which compiler versions were used, since I took the binaries from the archive.

Bebbo

PS: I can build it with gcc 2.95.3/binutils 2.9.1 from the amiga-toolchain but the compiled result does not work properly (exit after prompt). Guess it's one of the bugs I fixed in libnix...

Last edited by bebbo; 14 February 2017 at 15:42. Reason: added PS
bebbo is offline  
Old 14 February 2017, 18:48   #75
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 379
Quote:
Originally Posted by bebbo View Post
I don't know exactly which compiler versions were used, since I took the binaries from the archive.
m68k-amigaos-gcc (GCC) 3.4.0
sc 6.58
vbcc V0.9b
alkis is online now  
Old 14 February 2017, 21:35   #76
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 179
Quote:
Originally Posted by alkis View Post
m68k-amigaos-gcc (GCC) 3.4.0
sc 6.58
vbcc V0.9b
The vbcc V0.8j might be faster, at least it was in my recent experiments, see best c compiler for Amiga

Bebbo

Last edited by bebbo; 14 February 2017 at 22:02.
bebbo is offline  
Old 16 February 2017, 12:58   #77
sbergmann
Registered User
sbergmann's Avatar
 
Join Date: Mar 2015
Location: Germany
Age: 39
Posts: 23
I started to work on a Dockerfile for building a Docker image with this toolchain: https://github.com/sebastianbergmann...ter/Dockerfile
sbergmann is offline  
Old 16 February 2017, 14:08   #78
patrik
Registered User
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeň
Age: 37
Posts: 376
Quote:
Originally Posted by bebbo View Post
The vbcc V0.8j might be faster, at least it was in my recent experiments, see best c compiler for Amiga

Bebbo
How does the vbcc performance compare between 0.8j and 0.9e for other optimization levels than -O4? Would be interesting to se results for -Os, -O1, -O2, -O3. Maybe the performance regression in recent versions is triggered by certain levels of optimization.
patrik is offline  
Old 16 February 2017, 17:24   #79
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 179
Quote:
Originally Posted by patrik View Post
How does the vbcc performance compare between 0.8j and 0.9e for other optimization levels than -O4? Would be interesting to se results for -Os, -O1, -O2, -O3. Maybe the performance regression in recent versions is triggered by certain levels of optimization.
Good question! Someone may check this!

Bebbo
bebbo is offline  
Old 17 February 2017, 14:58   #80
patrik
Registered User
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeň
Age: 37
Posts: 376
Quote:
Originally Posted by bebbo View Post
Good question! Someone may check this!

Bebbo
What hardware did you run the benchmark on?
patrik is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 11:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 23:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 04:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 22:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 15:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:44.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.48471 seconds with 13 queries