News for hackers. Stuff that matters.
Re:Does a compiler use all x86 instructions? (2010) by rwmj on Wednesday August 24, 2016 @12:41PM (#12353304)
lea is used to implement addition in OCaml: http://caml.inria.fr/pub/ml-archives/caml-list/2004/07/e86a2...
Re:Does a compiler use all x86 instructions? (2010) by dibanez on Wednesday August 24, 2016 @12:48PM (#12353354)
Yea, I've seen compilers use lea for some integer math in C/C++, because it is handled by a different part of the CPU and so can happen in parallel with other integer math ops.
Re:Does a compiler use all x86 instructions? (2010) by rwmj on Wednesday August 24, 2016 @12:52PM (#12353377)
People might say this, but it's not really true. All these instructions are decomposed into micro-ops, and then the micro-ops are run in parallel - if data dependencies allow that - on a common pool of integer ALUs. The reason to use lea is for code compression - it allows you to express two or three operations in a single instruction.
Re:Does a compiler use all x86 instructions? (2010) by cperciva on Wednesday August 24, 2016 @12:59PM (#12353427)
On some Intel CPUs there are separate address-computation execution units.