3 ms·
Depends on the processor, but no. Most processors will decode an instruction into micro-ops and guess what that decode phase can do? It can say "Is this a pow
by cogman10 7y ago
Depends on the processor, but no.
Most processors will decode an instruction into micro-ops and guess what that decode phase can do? It can say "Is this a power of 2? Great, engage the shifting operator".
Only on super simple processors (think embedded systems) would this ever actually make a difference. Anything else, this is an optimization that your processor is going to do for you automatically.
- lern_too_spel 7y agoAre there any processors that do this? I am not aware of any.
- ynik 7y agoThe decode phase can't do that, because it runs before the input values for the instruction are available.
- KMag 7y agoPresumably the GP was talking about multiplying by an immediate value embedded in the instruction. That would be possible, but I doubt there are any current processors that do so.
- lgg 7y agoYou can do it in decode if the relevant operand is encoded as an immediate. I'm not aware of any processors that do any of the strength reductions discussed here in that way.