x86 内联 yasm 转换为 x64
x86 inline yasm convert to x64
我有项目使用内联 yasm 来实现。
现在,该项目使用 openMP 并行任务以获得更好的性能。
在 x86 平台上,openMP 不能 运行,原因是 x86 环境没有足够的内存。所以我用x64环境编译了一下,可以运行ning。但是当我使用yasm代码优化性能时,它并没有那么好用。(yasm的代码是在x86环境下写的。)
我搜索了所有相关信息,但找不到任何有用的信息来解决这个问题。
谁能告诉我解决问题的方法。
我想看看那个有关系信息的文档。
感谢您的帮助。
如果没有您的代码,我最好的猜测是您应该阅读 this 了解 AMD64 ABI 并查看 x64 平台中的调用约定标准。我认为这应该适合你。正如该文档所说,您必须按如下方式传递参数(请注意,您必须首先使用 ABI 标准中描述的方法对参数进行分类):
- If the class is MEMORY, pass the argument on the stack.
- If the class is INTEGER, the next available register of the sequence
%rdi
, %rsi
, %rdx
, %rcx
, %r8
and %r9
is used.
- If the class is SSE, the next available vector register is used, the registers are taken in the order from
%xmm0
to %xmm7
.
...
我有项目使用内联 yasm 来实现。 现在,该项目使用 openMP 并行任务以获得更好的性能。 在 x86 平台上,openMP 不能 运行,原因是 x86 环境没有足够的内存。所以我用x64环境编译了一下,可以运行ning。但是当我使用yasm代码优化性能时,它并没有那么好用。(yasm的代码是在x86环境下写的。)
我搜索了所有相关信息,但找不到任何有用的信息来解决这个问题。
谁能告诉我解决问题的方法。 我想看看那个有关系信息的文档。
感谢您的帮助。
如果没有您的代码,我最好的猜测是您应该阅读 this 了解 AMD64 ABI 并查看 x64 平台中的调用约定标准。我认为这应该适合你。正如该文档所说,您必须按如下方式传递参数(请注意,您必须首先使用 ABI 标准中描述的方法对参数进行分类):
- If the class is MEMORY, pass the argument on the stack.
- If the class is INTEGER, the next available register of the sequence
%rdi
,%rsi
,%rdx
,%rcx
,%r8
and%r9
is used.- If the class is SSE, the next available vector register is used, the registers are taken in the order from
%xmm0
to%xmm7
.
...