3 ms·
Have you seen how terrible SH code generation is? At least code compiled in 2005-2009. Unnecessary moves: mov r0, r3 <-result from a subroutine mov r3, @r4 m
by techwiz137 3y ago
Have you seen how terrible SH code generation is? At least code compiled in 2005-2009. Unnecessary moves:
mov r0, r3 <-result from a subroutine
mov r3, @r4
mov @r4, r3
do something with value.
And many many more examples like this. Wasting cycles and space.
- TapamN 3y agoYes, I do Dreamcast homebrew, and even with GCC 12.2, the compiler does such stupid, stupid things. The SH has addressing modes for postincrement reads and predecrement writes, so something like var = *ptr++; can be compiled down to a single instruction. But GCC almost always does something moronic. I've seen it generate code equivalent to: ptr++; tmp = ptr; tmp -= 16; var = tmp[15]; Insane. Older versions of GCC (3.x) are generally much better at low level instruction selection, but newer versions are better at big-picture stuff like optimizing across function calls, so speed-wise, across a whole program, they aren't too dissimilar. Newer versions are still worth it for the feature set (better warnings, modern standards like C23/C++23, etc).