1

I've been give a task to convert small piece of asm into intrinsic in order to test performance. I ve never developed any code for either one, but I understand asm and c, and reading up on intrinsic syntax. But I cant find info on how intrinsic is dealing with accessing registers. i found 2 functions:

getReg() and setReg()

getReg() comes with a table of different register tables and their id/number: -General Integer Registers -Application Registers -Control Registers -Indirect Registers But none of them seems to correspond to asm registers like rax,rdi and so on.

How can I address registers eg rcx, rdi and so on in intrinsic? Or in other words how can I convert this:

mov %0, %rcx

to intrinsic equivalent?

4

2 回答 2

5

您错过了内在函数的要点-使用内在函数时无需担心寄存器分配(在某些情况下可能访问特殊寄存器的情况除外)。一般的想法是让编译器为你处理所有这些低级的内务。要将原始 asm 移植到内在函数,您需要首先对 asm 代码进行逆向工程,以便您了解它的含义,然后使用内在函数重新实现等效代码。如果您发布一些实际代码,那么您可能会得到更具体的建议。

于 2011-10-03T10:55:19.157 回答
1

看看你是否可以使用这些:
GCC:X86 内置函数
MSVC++:按字母顺序排列的内部函数列表

于 2011-10-03T11:08:30.207 回答