Compiler Explorer Dreamcast Templates

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1873
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 79 times
Been thanked: 61 times
Contact:

Compiler Explorer Dreamcast Templates

Post by GyroVorbis »

Not sure how many of the forum lurkers know, but Matt Godbolt has given us the SH GCC toolchains in Compiler Explorer, which we can now use (with the proper flags) to analyze Dreamcast code generation from C and C++ within the web browser.

The latest SH toolchain version in Compiler Explorer exactly matches the GCC12.2.0 found within our "testing" KOS toolchain configuration, so the code generated should be an exact match once the flags match.

I've written about it on the wiki and have also included the list of flags as well as a link to two "Hello World" templates you can use to quickly slap code into a Dreamcast build environment. The first is C17, the second is C++20:

https://dreamcast.wiki/SH4_in_Compiler_Explorer
These users thanked the author GyroVorbis for the post:
Ian Robinson
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1873
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 79 times
Been thanked: 61 times
Contact:

Re: Compiler Explorer Dreamcast Templates

Post by GyroVorbis »

I've updated the templates to include the new GCC13 toolchain plus GCC versions 4.x.x and 9.x.x to approximate the legacy and stable toolchain configurations for KOS.

I've added details on a few more recommended flags, plus I've added the main results of darc's pvrmark GCC benchmarks.

Hopefully this will be a useful place for people to quickly get a one-click DC-esque compiler environment in the browser with useful optimization tips.
|darc|
DCEmu Webmaster
DCEmu Webmaster
Posts: 16373
Joined: Wed Mar 14, 2001 6:00 pm
Location: New Orleans, LA
Has thanked: 103 times
Been thanked: 90 times
Contact:

Re: Compiler Explorer Dreamcast Templates

Post by |darc| »

GyroVorbis wrote: Wed May 17, 2023 7:10 am I've updated the templates to include the new GCC13 toolchain plus GCC versions 4.x.x and 9.x.x to approximate the legacy and stable toolchain configurations for KOS.
Just keep in mind 4.7.4 (our "legacy" configuration) doesn't have the -mfsrra and -mfsca flags, whereas 4.9.4 does, so this might not be the best comparison.

I have a working patch for building GCC 4.9.4 available in the gccdev branch of KOS, if anyone wants to play with it, but keep in mind it hasn't been tested, and requires your host GCC be version 10 or earlier to build it.
These users thanked the author |darc| for the post:
Ian Robinson
It's thinking...
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1873
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 79 times
Been thanked: 61 times
Contact:

Re: Compiler Explorer Dreamcast Templates

Post by GyroVorbis »

|darc| wrote:Just keep in mind 4.7.4 (our "legacy" configuration) doesn't have the -mfsrra and -mfsca flags, whereas 4.9.4 does, so this might not be the best comparison.
Crap, good point... and I should probably mention those flags aren't supported when I describe them too...
|darc| wrote:I have a working patch for building GCC 4.9.4 available in the gccdev branch of KOS, if anyone wants to play with it, but keep in mind it hasn't been tested, and requires your host GCC be version 10 or earlier to build it.
Maybe Ian Michael can be the one to test the crap out of it? :grin:
These users thanked the author GyroVorbis for the post:
Ian Robinson
Post Reply