Why MOV AH,1 is not supported in 64 bit mode of intel microprocessor?

后端 未结 2 762
北海茫月
北海茫月 2020-12-20 03:29

In the book \"THE INTEL MICROPROCESSORS\" of Barry B. Brey, it is written that

MOV AH, 1

is not allowed in 64 bit mode, but allowed in 32

2条回答
  •  鱼传尺愫
    2020-12-20 03:50

    Please also note that, according to the Intel optimization manual, the use of 8-bit register is discouraged for some processors, while for other not. Currently, it is only discourage for Knights Landing, but in future the list of processors where 8-bit and 16-bit instructions would work slower may grow. Intel wrote the following in the manual:

    Instructions that operate on 8-bit or 16-bit registers are not optimized in hardware in the Knights Landing microarchitecture. In general, it is faster to use integer instructions operating on 32-bit or 64-bit general purpose registers than 8-bit or 16-bit registers.

    Although the Knights Landing is not a general-purpose CPU, I anticipate the tendency that on all future processors, probably, in a next major microarchitecture change, namely, since the Icelake microarchitecture, which is the Intel CPU microarchitecture based on the 10nm node that is expected to replace Cannonlake in 2019 - the 8-bit and 16-bit register operation will be slow, and not just write, but the read also (Disclaimer: this anticipation of mine is a pure speculation).

    So, back to the ah register - you cannot encode, for example, movzx r8, ah in 64-bit mode, but you can encode anything with the ah register per se, e.g. mov ah, 1 - because AMD has designed the 64-bit mode in such a way that the old instructions are encoded the same way as in the old 32-bit mode.

提交回复
热议问题