cr1901 changed the topic of ##yamahasynths to: Channel dedicated to questions and discussion of Yamaha FM Synthesizer internals and corresponding REing. Discussion of synthesis methods similar to the Yamaha line of chips, Sound Blasters + clones, PCM chips like RF5C68, and CD theory of operation are also on-topic. Channel logs: https://libera.irclog.whitequark.org/~h~yamahasynths
<fseidel>
andlabs: right, I just meant that with Sharp's compiler, you'll see it store things on the stack that really could have stayed in a register
<fseidel>
because the register allocator isn't great, but hey, it was the late 80s
<qu1j0t3>
gcc was exceedingly good by the late 80s :) it was the first compiler to shock me with codegen choices (in a good way)
<qu1j0t3>
(on 68k)
<fseidel>
indeed, Human68K GCC 1.x blows Sharp
<fseidel>
's compiler out of the water
<fseidel>
that was an unfortunate place to accidentally press enter...
<fseidel>
there have been some regressions in recent M68K-GCC, it no longer generates DBRA, even for trivial to transform do{}while() loops...
<fseidel>
so there's probably a sweet spot version if you want to do 68K dev.
<qu1j0t3>
fseidel: yeah, i even remmeber it was 1.37
<qu1j0t3>
fseidel: and the specific optimisation was integer constant multiply, decomposing bitwise,, iirc
<qu1j0t3>
probably didn't hurt that sun3 was common at institutions
<fseidel>
I think the first compiler optimization I can remember noticing and making me think "neat!" was a division by a constant being transformed into a multiply by its modular multiplicative inverse
<fseidel>
unless I'm mistaken as to what's going on here, I can't really fault the compiler, as the definition of calloc given is not standards compliant
<fseidel>
that's a completely legal transformation in a standards-following C environment
<qu1j0t3>
yes, it's in that grey area of 'not strictly wrong, but not necessarily unsurprising and ergonomic either'
<qu1j0t3>
but, heck, you're using C already lol
<qu1j0t3>
also there are very many optimisations like this that most people just aren't aware of, so it's a bit mine-fieldy
<qu1j0t3>
also, ofc, anything UB
<fseidel>
oh, absolutely. I'm not trying to defend C in general.
<qu1j0t3>
fseidel: here's another high level opt i found out about a few years ago. You can open code bit rotation and it will code gen a ROT instruction in many archs.
<qu1j0t3>
that's also likely surprising to a lot of C coders
<fseidel>
as reliable(?) as that peephole is, I really wish C had a rotate operator without the need to rely on platform dependent intrinsics
<fseidel>
obviously that's the least of its issue, but it would be nice.
<qu1j0t3>
:)
<qu1j0t3>
pretty sure that one's in gcc and clang at least
<andlabs>
"sets the initial pc to $0... which starts the 68000 off reading the high word of the initial sp as an opcode... which is $FFFF, which is illegal... which jumps to the illegal opcode exception handler... which is at where the original initial pc was anwyay, so ?????????"
<andlabs>
I'm also trudging through some pirates and they can get really wacky
SceneCAT^APUG has joined ##yamahasynths
SceneCAT has quit [Ping timeout: 250 seconds]
SceneCAT^APUG has quit [Ping timeout: 240 seconds]
SceneCAT has joined ##yamahasynths
SceneCAT has quit [Quit: *Mreow*]
andlabs has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]