Encoding ADC EAX, ECX - 2 different ways to encode? (arch x86)

后端 未结 2 2155
清歌不尽
清歌不尽 2020-12-19 04:29

I\'m looking through an Intel Instruction Set manual, and it looks like there are 2 different forms of ADC that would match/encode ADC EAX, ECX as

2条回答
  •  被撕碎了的回忆
    2020-12-19 04:45

    This is redundancy of instruction encoding. Any architecture that use multiple parameters in the instruction has this.

    Think of a RISC architecture that have add rx, ry, rz that assigns the sum of ry and rz into rx then you can encode add rx, ry, rz or add rx, rz, ry, they'll all be equivalent.

    In x86 we (normally) have only 2 parameters for each instruction but you can select the direction between them since you can store to or read from memory. If you don't use memory then you can choose the direction between the 2 registers, so there are 2 encoding ways

    You can use this to identify some compilers/assemblers. For some assemblers you can choose which encoding to use. In GAS you can use .s suffix to force it to emit the alternate encoding

    10 de   adcb   %bl,%dh
    12 f3   adcb.s %bl,%dh
    

提交回复
热议问题