Replying to @marc_b_reynolds
Oh wow, that's an amazing explosion. GCC's fixed optimization pipeline does not have a tail recursion elimination pass before inlining, so it first does some generous recursive inlining, before one of the calls is transformed to a loop.
2
Fun MIPS64 fact: if you bind a 32-bit integer variable to an output register operand of an inline asm, GCC assumes your asm sign-extends the register even if bound variable is unsigned:
1
Very short, just a loop and its hand-unrolled equivalent: github.com/kjn/lbzip2/blob/b…
It's also amazing how perfectly pshufb slots in in their inverse MTF transform (this eliminates almost half of mispredicted branches).
1
2
How could I not when you're being so humble, lbzip2 authors (what follows is actually fairly readable code).
Replying to @_monoid @ilyakurdyukov
And x86-info-term gives a nice console browser for (a subset of) uops.info data:
1
@johnregehr No need to be apologetic about reporting a fresh miscompilation, especially at -O2. It is extremely valuable, because the alternative is digging through 1000x the amount of code when some real-world package gets broken:
2
9
This trick needs an additional tweak to be useful: you get SIGBUS upon accessing the mapped range if reserved hugepages are not available (which is the default).
To solve this, I mmap a second time over the returned range, with MAP_FIXED replacing MAP_HUGETLB|MAP_NORESERVE.
1













