Re:GodBolt: Enter C, get Assembly
by eridius on Thursday December 15, 2016 @03:08AM
(#13183205)
Impressive? Those are probably specially-coded optimizations rather than the result of generic optimizations.
[ Parent
| on HN ]
Re:GodBolt: Enter C, get Assembly
by JoshTriplett on Thursday December 15, 2016 @03:18AM
(#13183228)
As I understand it, the bswap optimization doesn't pattern-match for that specific code (and it works for any equivalent shift/mask code); it analyzes the flow of the bits to figure out the final bit pattern relative to the original, realizes the whole expression had the effect of a bswap, and substitutes a bswap.
Actually, in LLVM's case it really is just explicitly checking for a few specific bswap patterns rather than doing anything fancy:
https://github.com/llvm-mirror/llvm/blob/master/lib/Transfor...
Yes, that's called pattern matching.