<div dir="ltr">I've tried all the types (both for result and Intrinsic ID), can't seem to find what cast is causing the issue here.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 11:47 AM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>That's what I thought but I got the same error with: </div><div><br></div><div>DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, VT, DAG.getTargetConstant(Intrinsic::my_intrinsic, DL, MVT::i16), LHS);</div><div><br></div><div>Thanks.</div><div><br></div><div>What should this call look like?</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 10:53 AM, <span dir="ltr"><<a href="mailto:escha@apple.com" target="_blank">escha@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">The intrinsic ID is an int, not a float.<div><br></div><div>—escha</div><div><br><div><blockquote type="cite"><div><div><div>On Jun 24, 2016, at 7:49 AM, Ryan Taylor via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br></div></div><div><div><div><div dir="ltr"><div>given the following C code:</div><div><br></div><div>float b=16, a=0;</div><div>int main() {</div><div> float a = sqrt(b);</div><div> return0;</div><div>}</div><div><br></div><div>I'm trying to lower FSQRT down, but getting a casting issue, my code is:</div><div><br></div><div>SDValue XXXLowering::LowerFSQRT(SDValue Op, SelectionDAG &DAG) const {</div><div> SDLoc DL(Op);</div><div> EVT VT = Op.getValueType();</div><div> SDValue LHS = Op.getOperand(0);</div><div><br></div><div> SDValue newNode = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, VT, DAG.getTargetConstantFP(Intrinsic::my_intrinsic, DL, VT), LHS);</div><div> return newNode;</div><div>}</div><div><br></div><div>The error I'm getting is: Assertion 'isa<X>(Val) && "cast<Ty>() argument of incompatible type!"</div><div><br></div><div>Is this the correct way to add intrinsic dag node?</div><div><br></div><div>Thanks.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 2, 2016 at 5:10 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Matt, </div><div><br></div><div> The added intrinsic in DAG looks like:</div><div><br></div><div>0xbedb698: i32 = llvm.MyIntrinsic 0xbedb200, 0xbedac18 [ORD=4]</div><div><br></div><div> The builtin in DAG looks like:</div><div><br></div><div>0xbedb2a8: i32,ch = llvm 0xbedb158:1, 0xbedb200, 0xbedb158 [ORD=7] [ID=16]<br></div><div><br></div><div> The only difference I'm seeing is the extra operand, which is a 'ch' from a load.<br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 2, 2016 at 3:55 PM, Matt Arsenault <span dir="ltr"><<a href="mailto:arsenm2@gmail.com" target="_blank">arsenm2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Feb 2, 2016, at 12:43, Ryan Taylor <<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>> wrote:<br>
><br>
> Matt,<br>
><br>
</span><span>> This seems to generate llvm.my_intrinsic just fine in the DAG, so no DAG errors; however, it won't match. For example, if I call the intrinsic from C, the DAG node looks to be named the same in dotty file but it won't match... am I missing something?<br>
><br>
> I've done it exactly the way it was done above. The DAG looks great but it won't match. Did I miss something?<br>
><br>
> Thanks.<br>
><br>
<br>
</span>Are you using the right intrinsic type? Does it have a chain or result?<br>
<br>
How are you calling it from C? Are you declaring the intrinsic? This can fail if you mismatched the readnone or readonly to the actual intrinsic definition<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div><span>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></span></div></blockquote></div><br></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>