Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

gcc - what is the order of source operands in AT&T syntax compared to Intel syntax?

The Intel ISA reference documentation for this instruction is clear:

VPBLENDVB xmm1, xmm2, xmm3/m128, xmm4

Select byte values from xmm2 and xmm3/m128 using mask bits in the specified mask register, xmm4, and store the values into xmm1.

xmm1 is the destination, xmm2/3/4 are source operands

So what does this become using AT&T syntax? We know that the destination register must be last, but what is the order of source operands?

vpblendvb $xmm2, $xmm3, $xmm4, $xmm1

or

vpblendvb $xmm4, $xmm3, $xmm2, $xmm1

or something else?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Assembling (note GAS uses % instead of $ to denote registers) the following:

vpblendvb %xmm4, %xmm3, %xmm2, %xmm1

with the GNU assembler (version 2.21.0.20110327 on x86_64 2.6.38 linux) and then disassembling yields:

$ objdump -d a.out
    0:    c4 e3 69 4c cb 40     vpblendvb %xmm4,%xmm3,%xmm2,%xmm1

in intel syntax (as the manual shows):

$ objdump -d -M intel a.out
    0:    c4 e3 69 4c cb 40     vpblendvb xmm1,xmm2,xmm3,xmm4

So it looks like the order of all the arguments is reversed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...