<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Never mind.<div><br></div><div>Looks my bad is:  I did not  put the “right” type/format in the instruction.</div><div><br></div><div>Tim is RIGHT!</div><div><br></div><div>tks</div><div><br></div><div>kevin</div><div><br></div><div><br><div><div>On Jul 24, 2014, at 9:18 AM, kewuzhang <<a href="mailto:kewu.zhang@amd.com">kewu.zhang@amd.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Thanks Tim, <div><br></div><div>Yeah!, you are right!</div><div><br></div><div>Also, looks we have to set up a pattern to use the intrinsic node too.</div><div><br></div><div><br></div><div>I did something like this:</div><div><blockquote type="cite">def  int_my_test : Intrinsic</blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span> <llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],</blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">    </span>[IntrReadWriteArgMem],<br><span class="Apple-tab-span" style="white-space: pre;">  </span>>;</blockquote></div><div>and used it directly with the test call  "call<float> @my.test( <float> %r0, <float> *%p1)."</div><div>It compiles fine. and “int_my_test" intrinsic is caught under INTRINSIC_WO_CHAIN.</div><div><br></div><div>Because anyway I have to handle this intrinsic by lowering, I did not think a pattern is necessary. </div><div>Just left a [ ] there, looks we have to put something there even it is not really needed.</div><div><br></div><div>but then the argument is:  is it really necessary to put a pattern for it? </div><div><br></div><div>For my case, because I need to access memory, I think a chain is necessary.  but what type of pattern is meaningful?</div><div><br></div><div><b>for example </b></div><div><b>intrinsic “ float llvm.my.sincos( float src, *float res)”, </b></div><div><b>sin result is returned, and cos result is write back to the second pointer argument.</b></div><div><br></div><div><br></div><div>tks</div><div><br></div><div><br></div><div>kevin</div><div><br></div><div><br></div><div><div><br></div><div><div>On Jul 23, 2014, at 3:56 PM, Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite">def int_x86_xtest : GCCBuiltin<"__builtin_ia32_xtest">,<br>              Intrinsic<[llvm_i32_ty], [], []>;<br><br>which  CALL makes the “Intrinsic::x86_xtest” is caught under<br>“INTRINSIC_W_CHAIN”? feel I missed something, but did not figure out.<br></blockquote><br>It's this first definition that spawns the INTRINSIC_W_CHAIN. The rest<br>are x86-specific SDNodes, defined in X86ISelLowering.h and only ever<br>created from X86ISelLowering.cpp.<br><br>I assume (haven't checked) there's some special bit of<br>X86ISelLowering.cpp that takes an ISD::INTRINSIC_W_CHAIN node<br>referring to the int_x86_xtest intrinsic and turns it into an<br>X86ISD::XTEST node.<br><br>Specifically, for the W_CHAIN/WO_CHAIN distinction you want to be<br>looking at the "IntrNoMem" definition and uses in include/[1]. That<br>should be what determines which path an intrinsic goes down.<br><br>Cheers.<br><br>Tim.<br><br>[1] If you're interested, the code most directly responsible for<br>choosing between them is in visitTargetIntrinsic in<br>lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp. It's helped by<br>TableGen and other components, of course.<br></blockquote></div><br></div></div></blockquote></div><br></div></body></html>