在编写内联程序集时,有没有办法强制使用rex。W前缀?
所以不是
"psllq $12, %%xmm1\n"
生成 66 0f 73 f1 0c ,我想要 66 48 0f 73 f1 0c ,带有额外的0x48 rex。W前缀。
66 0f 73 f1 0c
66 48 0f 73 f1 0c
编辑: 我在最初的标题上犯了一个错误,问题是叮当而不是GCC。
insn_sse2.c:11794:11: error: unexpected token in argument list "rex.W psllq $12, %%xmm1\n" ^ <inline asm>:7:13: note: instantiated into assembly here rex.W psllq $12, %xmm1
你可以添加 rex.W 前缀
rex.W
rex.W psllq $12, %xmm1
这正是GNU binutils将如何反汇编您给定的操作码字节。从包含内容的psllq.s文件
.byte 0x66, 0x48, 0x0f, 0x73, 0xf1, 0x0c
我们可以跑步 as psllq.s -o psllq.o && objdump -d psllq.o 以获得:
as psllq.s -o psllq.o && objdump -d psllq.o
psllq.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <.text>: 0: 66 48 0f 73 f1 0c rex.W psllq $0xc,%xmm1