开发者

Converting inline ASM to Intrinsic

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: -G开发者_如何学Goeneral 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?


You're missing the point of intrinsics - you don't need to worry about register allocation when using intrinsics (except perhaps in the case of access to special registers in some cases). The general idea is to let the compiler take care of all this kind of low level house-keeping for you. To port raw asm to intrinsics you need to firstly reverse-engineer the asm code, so that you understand what it is meant to do, then re-implement the equivalent code using intrinsics. If you post some of the actual code then you may get more specific suggestions.


See if you can use any of these:
GCC: X86 Built-in Functions
MSVC++: Alphabetical Listing of Intrinsic Functions

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜