Marc, I would like to ask your opinion on an implementation question.
If I want to load a 8 or 16 bit machine from memory into a 32/64 bit register, it seems I would have to do a mov from memory to the lower 8 or 16 bits of the register. However, one problem presents itself: possibly, the remainder of the register was already storing some other 32/64 bit value, and so the upper bits might be nonzero. This would imply that if I want to load a value smaller than the register, I would have to zero-out the register with xor first.
Do you know of a more efficient way of achieving this with just one instruction?
- Maxime