Hacker News new | ask | show | jobs
by oriolid 3309 days ago
I've also been working with DSP processors in audio processing. The only time I've used actual inline assembly was storing stack pointer to measure stack usage.

For saturating arithmetic and other stuff we used compiler intrinsics, which freed us from handling register allocation, stack management etc by hand. On that processor there weren't special instructions for saturating arithmetic but a flag was used instead, the compiler also kept track of that one too.

We did read the assembly result and tweaked C code until assembly looked like what was expected, though.

1 comments

Technically, assembly is not required for measuring stack: just use regular C address of any local variable/function argument (minus an address of some local variable in main) to have some approximation of stack usage.
True. But I was young, stupid and had just completed a course on assembler on that processor. Money well spent.