Re:Wc in D: 712 Characters Without a Single Branch
by agumonkey on Tuesday January 28, 2020 @11:49AM
(#22171118)
slightly related, does embedding arithmetic in mov instructions go faster than explicit ALU operations ?
[ Parent
| on HN ]
Re:Wc in D: 712 Characters Without a Single Branch
by Filligree on Tuesday January 28, 2020 @01:11PM
(#22172238)
Depending on the arithmetic, it seems that yes it can! I've noticed gcc using LEA instructions for arithmetic of the form (x * a + b), where 'a' and 'b' fit with the instruction.
Re:Wc in D: 712 Characters Without a Single Branch
by jnordwick on Tuesday January 28, 2020 @02:06PM
(#22172913)
Using LEA (load effective address) for calculation seems to be pretty common in most programs for both gcc and llvm. You basically get smaller code, and it used to schedule them better across more execution ports. Not sure if the CPU can fuse the ADD+MUL now.