zhi chen
2015-Apr-24 05:26 UTC
[LLVMdev] undefined reference to 'llvm.x86.sse2.sqrt.pd.v2f64'
I used the following way to create an x86_sse2_sqrt_pd intrinsic instruction: Value *Approx::CreateVFSqrt(IRBuilder<> &builder, Value *v, const std::string& Name) { Type *tys[] = {v->getType()}; Module* M = currF->getParent(); Value* sqrtv = Intrinsic::getDeclaration(M, Intrinsic::x86_sse2_sqrt_pd, tys); Value *CI = builder.CreateCall(sqrtv, v, Name); return CI; } I can compile it with clang++ and then generate the assembly code with llc. However, it gives me and error "undefined reference to 'llvm.x86.sse2.sqrt.pd.v2f64'" when I want to generate the executable with gcc. BTW, I opened the assembly code and I can see an instruction "calll llvm.x86.sse2.sqrt.pd.v2f64" in the file. Any hint would be appreciated! Best, Zhi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150423/1be2d4c8/attachment.html>
zhi chen
2015-Apr-24 06:16 UTC
[LLVMdev] undefined reference to 'llvm.x86.sse2.sqrt.pd.v2f64'
It's fixed. I can just use intrinsic::sqrt instead of x86_sse_sqrt_pd. On Thu, Apr 23, 2015 at 10:26 PM, zhi chen <zchenhn at gmail.com> wrote:> I used the following way to create an x86_sse2_sqrt_pd intrinsic > instruction: > > Value *Approx::CreateVFSqrt(IRBuilder<> &builder, Value *v, const > std::string& Name) { > Type *tys[] = {v->getType()}; > Module* M = currF->getParent(); > > Value* sqrtv = Intrinsic::getDeclaration(M, Intrinsic::x86_sse2_sqrt_pd, > tys); > Value *CI = builder.CreateCall(sqrtv, v, Name); > > return CI; > } > > I can compile it with clang++ and then generate the assembly code with llc. > > However, it gives me and error "undefined reference to > 'llvm.x86.sse2.sqrt.pd.v2f64'" when I want to generate the executable with > gcc. BTW, I opened the assembly code and I can see an instruction "calll > llvm.x86.sse2.sqrt.pd.v2f64" in the file. Any hint would be appreciated! > > Best, > Zhi >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150423/b1f3db51/attachment.html>