[LLVMdev] problem compiling x86 intrinsic function
fimarn at yahoo.com
Tue Dec 29 12:47:04 PST 2009
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.
----- Original Message ----
From: Chris Lattner <clattner at apple.com>
To: fima rabin <fimarn at yahoo.com>
Cc: LLVMdev at cs.uiuc.edu
Sent: Tue, December 29, 2009 2:57:27 PM
Subject: Re: [LLVMdev] problem compiling x86 intrinsic function
On Dec 29, 2009, at 5:50 AM, fima rabin wrote:
> I am trying to compile this little C-program:
> typedef double v2f64 __attribute__((ext_vector_type(2)));
> int sse2_cmp_sd(v2f64, v2f64, char ) asm("llvm.x86.sse2.cmp.sd");
We used to support this, but there are problems with it. I actually just went to go implement this again, which illustrated why this is a bad idea. If you apply this patch to clang, it will do what you want:
The problem with this is that the optimizer and code generator will explode if the generated intrinsic has the wrong attributes or type. In this case, you have both problems.
Depending directly on llvm intrinsics is also a dangerous thing to do because they are allowed to change over time. I don't think we want the compiler exposing them directly. If you need something, there should be a __builtin that corresponds to the intrinsic.
More information about the llvm-dev