我正试图编译苹果的Libm (2026版本,tarball在这里)。唯一无法正确编译的文件是Source/Intel/frexp.s,因为
/<path>/Libm-2026/Source/Intel/frexp.s:239:5:
error: invalid instruction mnemonic 'movsxw'
movsxw 8+(8 + (32 - 8))(%rsp), %eax
^~~~~~
/<path>/Libm-2026/Source/Intel/frexp.s:291:5:
error: invalid instruction mnemonic 'movsxw'
movsxw 8(%rsp), %eax
^~~~~~环顾互联网,我只能找到关于movsxw指令的非常少的细节,但它似乎确实存在于i386体系结构中。我正在使用核心i5处理器运行OSX10.9.3。宏__x86_64__是预先定义的,但是似乎__i386__宏不是*。
我的印象是x86_64指令集与i386完全兼容。这不对吗?我只能假设movsxw指令不存在于x86_64指令集中,因此我的问题是:它是做什么的,我可以从x86_64指令集替换它吗?
*查询:clang -dM -E -x c /dev/null
发布于 2014-06-01 12:45:45
movsxw的标准at&t语法是movswl,尽管至少有些汇编程序版本似乎也接受前者。
发布于 2014-06-01 07:03:10
movsxb : Sign-extend a byte into the second operand
movsxw : Sign-extend a word (16 bits) into the second operand
movsxl : Sign-extend a long (32 bits) into the second operand使用gcc/as (4.8.1/2.24),movsxw在64位模式下为我装配得很好。我在这台机器上没有为x86安装clang,但是您可以尝试指定第二个操作数的大小(即将movsxw更改为movsxwl,这将是“将单词符号扩展为长”)。
https://stackoverflow.com/questions/23977130
复制相似问题