<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Taco,<br>
I think I know what is happening here, I ran into it not too long
ago.<br>
if you are calling pow with a base of 2, e.g. pow(2.0f, x), then
LLVM will try and optimise it to exp2f(x).<br>
However exp2f doesn't exist on windows.<br>
LLVM *should* know this, but it requires that you tell the target
triple to the optimisation passes, something like:<br>
<br>
fpm.add(new
llvm::TargetLibraryInfo(llvm::Triple(this->triple)));<br>
<br>
This requirement is undocumented.<br>
<br>
Even doing this, the issue will still occur in LLVM 3.3, but is
fixed in trunk.<br>
For this reason powf() is the only intrinsic I don't use yet, I
just use a call to the library function.<br>
<br>
Cheers,<br>
Nick<br>
<pre class="moz-signature" cols="72">Nicholas Chapman
Managing Director,
Glare Technologies Limited</pre>
On 18/09/2013 7:32 a.m., Taco H. in den Bosch wrote:<br>
</div>
<blockquote cite="mid:2ca2dca5$1c0e4d88$7dab9c00$@heddesit.nl"
type="cite"><span style="font-family: Tahoma, Geneva, sans-serif;
font-size: 10pt"><br>
<font size="2" face="Arial, Verdana">Hi everyone,</font>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;"><br>
</div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;">I am trying to call an LLVM intrinsic
(llvm.pow.f32), inserted with the following call:</div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;"><br>
</div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;">
<div>std::vector<llvm::Type *> arg_types;</div>
<div>arg_types.push_back(llvm::Type::getFloatTy(context));</div>
<div><span style="font-size: 10pt;">auto
function=llvm::Intrinsic::getDeclaration(module,
llvm::Intrinsic::pow, arg_types);</span></div>
</div>
<div><font size="2" face="Arial, Verdana">auto
result=ir_builder->CreateCall(function, args);</font></div>
<div><font size="2" face="Arial, Verdana"><br>
</font></div>
<div><font size="2" face="Arial, Verdana">When I try to execute
the code generated by the JIT compiler, I see that the
intrinsic is not compiled into a math coprocessor
instruction, but in a call to a null address:</font></div>
<div><font size="2" face="Arial, Verdana"><br>
</font></div>
<div><font size="2" face="Arial, Verdana">002300B8 sub
esp,8 </font></div>
<div><font size="2" face="Arial, Verdana">
<div>002300BB movss xmm0,dword ptr ds:[2300B0h] </div>
<div>002300C3 movss dword ptr [esp+4],xmm0 </div>
<div>002300C9 movss xmm0,dword ptr ds:[2300B4h] </div>
<div>002300D1 movss dword ptr [esp],xmm0 </div>
<div>002300D6 <span style="background-color: rgb(255, 255,
0);">call 00000000</span> </div>
<div>002300DB add esp,8 </div>
<div>002300DE ret </div>
</font></div>
<div><font size="2" face="Arial, Verdana"><br>
</font></div>
<div><font size="2" face="Arial, Verdana">Is there anything
special that I need to do in order to be able to call
intrinsics, either in general or when JITting? I am either
doing something wrong, or forgetting to do something, but I
don't know what.</font></div>
<div><font size="2" face="Arial, Verdana"><br>
</font></div>
<div><font size="2" face="Arial, Verdana">I am working with a
Visual Studio compiled version on Windows (x86).</font></div>
<div><font size="2" face="Arial, Verdana"><br>
</font></div>
<div><span style="font-family: Arial, Verdana; font-size:
small;">All hints will be appreciated, with kind regards,</span></div>
<div><span style="font-family: Arial, Verdana; font-size:
small;"><br>
</span></div>
<div><span style="font-family: Arial, Verdana; font-size:
small;">Taco H. in den Bosch.</span></div>
<div><span style="font-family: Arial, Verdana; font-size:
small;"><br>
</span></div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;"><br>
</div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;"><br>
</div>
<div style="font-family: Arial, Verdana; font-size: 10pt;
font-style: normal; font-variant: normal; font-weight: normal;
line-height: normal;"><br>
</div>
</span>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>