assembly
How to remove “noise” from GCC/clang assembly output?
Stripping out the .cfi directives, unused labels, and comment lines is a solved problem: the scripts behind Matt Godbolt’s compiler explorer are open source on its github project. It can even do colour highlighting to match source lines to asm lines (using the debug info). You can set it up locally so you can feed … Read more
Why doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
Because Floating Point Math is not Associative. The way you group the operands in floating point multiplication has an effect on the numerical accuracy of the answer. As a result, most compilers are very conservative about reordering floating point calculations unless they can be sure that the answer will stay the same, or unless you … Read more
MIPS program that implements the same algorithm in C
(thanks for posting it). You appear to be using this definition of system calls (https://www.assemblylanguagetuts.com/mips-syscall-services-table/) Just after the beq instruction in the while: loop, you increment $s1. I recall that MIPS cpus had a timing bug where it always executed the instruction following a branch. Here, that would mean that $s1 would be one more … Read more