x64 CVTSD2SI 指令和 REX.W

x64 CVTSD2SI instruction and REX.W

这是说明:

F2 REX.W 0F 2D /r CVTSD2SI r64, xmm/m64

Convert one double-precision floating-point 
value from xmm/m64 to one signed quadword 
integer sign-extended into r64.

我该如何编码? REX.W 是我遇到的问题。我只是用 0x48 还是 0x08 对操作码进行编码?所以操作码看起来像这样:F2, 48, 0F, 2D?

So the opcode would look like this: F2, 48, 0F, 2D?

没错。只需在它后面加上参数就可以了。例如:

cvtsd2si rax, xmm0  ; F2 48 0F 2D C0  (vex: C4 E1 FB 2D C0)
cvtsd2si r8, xmm0   ; F2 4C 0F 2D C0  (vex: C4 61 FB 2D C0)