assembly - Encoding ADC EAX, ECX - 2 different ways to encode? (arch x86) -
i'm looking through intel instruction set manual, , looks there 2 different forms of adc
match/encode adc eax, ecx
follows:
adc r/m32, r32 (11 /r , encodes 11c8)
or
adc r32, r/m32 (13 /r, encodes 13c1)
my question (given did math correctly), 11c8
, 13c1
equivalent? factors assembler consider in selecting 1 encoding on another? question perspective of implementing assembler, question in general, not particular hypothetical instruction.
if it's lengthy answer, please point me in right direction attempts @ googling failed.
this redundancy of instruction encoding. architecture use multiple parameters in instruction has this.
think of risc architecture have add rx, ry, rz
assigns sum of ry , rz rx can encode add rx, ry, rz
or add rx, rz, ry
, they'll equivalent.
in x86 (normally) have 2 parameters each instruction can select direction between them since can store or read memory. if don't use memory can choose direction between 2 registers, there 2 encoding ways
you can use identify compilers/assemblers. assemblers can choose encoding use. in gas can use .s
suffix force emit alternate encoding
10 de adcb %bl,%dh 12 f3 adcb.s %bl,%dh
Comments
Post a Comment