[LLVMdev] problem compiling x86 intrinsic function
clattner at apple.com
Tue Dec 29 13:06:59 PST 2009
On Dec 29, 2009, at 12:47 PM, fima rabin wrote:
> Thanks for your advice.
> I am not sure that I understood your comment "If you need something, there should be a __builtin that corresponds to the intrinsic." Is that a better way to define an intrinsic function in C? How do you do it?
> I am actually trying to add several intrinsic functions for my target machine so I am looking for a simple and workable way of doing it.
Ah ok. The 'right' way to do this is to add a builtin that correponds to the intrinsic. In the case of the one you listed, the builtin is __builtin_ia32_cmpsd. Depending on what frontend you're using, there are different ways to add the intrinsic. In clang, you can grep for __builtin_ia32_cmpsd in lib/codegen for an example. Another simpler way is to make the builtin correspond directly to the intrinsic with the 'GCCBuiltin' annotation in the intrinsic .td file.
More information about the llvm-dev