Re:Reverse-engineering the conditional jump circuitry in the...
by shadowofneptune on Monday January 23, 2023 @07:31PM
(#34497286)
LEA only got more powerful in later models as the restraints on registers were removed and more addressing modes got added. Now it can do several additions and a multiplication in a single operation. Reusing that memory hardware/instruction format is a clever ISA decision.
[ Parent
| on HN ]
Re:Reverse-engineering the conditional jump circuitry in the...
by Gordonjcp on Tuesday January 24, 2023 @03:54AM
(#34501225)
Wait, so if you were imaginative enough with how you use registers to calculate addresses you could abuse LEA as a DSP MAC (multiply/accumulate) instruction?
Re:Reverse-engineering the conditional jump circuitry in the...
by moefh on Tuesday January 24, 2023 @04:15AM
(#34501376)
Compilers do it all the time, for example GCC compiles "x*4 + y" to a single LEA instruction: https://godbolt.org/z/TvdW5sK4b
Re:Reverse-engineering the conditional jump circuitry in the...
by Gordonjcp on Tuesday January 24, 2023 @09:03AM
(#34503635)
Aha, playing with it, it looks like the multiply is just a shift because if you try to do anything other than powers of two it has to break it down into more instructions.
Still clever, though. I guess it's to make it easier and quicker to index over words or multiples of words?