Why are mov ah,bh and mov al, bl together much faster than single instruction mov ax, bx?

前端 未结 4 1992
长发绾君心
长发绾君心 2020-12-15 05:58

I\'ve found that

mov al, bl
mov ah, bh

is much faster than

mov ax, bx

Can anyone explain me why? I\'m run

4条回答
  •  一个人的身影
    2020-12-15 06:31

    In 32-bit code, mov ax, bx needs an operand-size prefix, whereas byte-sized moves don't. Apparently modern processor designers do not spend much effort at getting the operand-size prefix to decode quickly, though it surprises me that the penalty would be enough to do two byte-sized moves instead.

提交回复
热议问题