<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br><div><span id="result_box" class="short_text" lang="en"><span>Thank you very much, </span><span class=""></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class="">especially</span></span> for copying and testing</span></span><span id="result_box" class="short_text" lang="en"><span class=""> my code.</span></span></div><div><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class="">I am very surprised that </span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class="">the builtin is recognized. </span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">I successfully compile without errors.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">But when I use the fllowing file to test ,the error </span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en">occurs.</span></span></span></span></span></span></span></span></span></span></span></div><div><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><br>#include <stdio.h><br>int main()<br>{<br>  int a;<br>  int b;<br>  a=1;b=2;<br>  c = __builtin_x86_max_qb(a, b); <br></span></span></span></span></span></span></span></span></span></span></span></div><div><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en">  return 0;<br></span></span></span></span></span></span></span></span></span></span></span></div><div><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en">}<br></span></span></span></span></span></span></span></span></span></span></span></div><div><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">There is a place I don't understand very well, I want to ask you.</span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""></span></span></span></span></span></span></span></span></span></span></span></span></span></span> </span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">When did t</span></span>he </span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(117,0,0)"><b><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(117,0,0)"><b>fatal error</b></span></b></span></span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"> you get occur£¿</span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Compile or test after </span></span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">compiled£¿</span></span></span></span></span></span></span></span></span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span id="result_box" class="short_text" lang="en"><span class=""><span id="result_box" class="short_text" lang="en"><span class="">May you tell me how you test ?<br></span></span></span></span></div><div>As for something to connect the intrinsic to the <span style="color:rgb(0,0,0);font-family:Arial;font-size:14px">X86ISD::max_qb opcode, </span><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">do I need to add a DAG?</span></span></div><div><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class=""><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Thanks again</span></span></span></span></div><br><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br>At 2018-09-17 14:39:13, "Craig Topper" <craig.topper@gmail.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div dir="ltr">This all looks fine to me. I even pasted into my own repo and the builtin is recognized by my local build of clang. I got this error instead.<div><br></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(43,102,201)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(117,0,0)"><b>fatal error: </b></span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">error in backend: Cannot select: intrinsic %llvm.x86.max.qb</span></p><div><br></div><div>But the code you provide is missing anything to connect the intrinsic to the <span style="color:rgb(0,0,0);font-family:Arial;font-size:14px">X86ISD::max_qb opcode so that error is to be expected given what I copied and pasted.</span></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 16, 2018 at 11:06 PM ÉòÌìºÀ via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi£¬every one.</div><div><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>This problem has been bothering me for several days.</span></span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>I really hope that you can help me.</span></span></div><div><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>I want to add an trinsics in X86. This </span></span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>trinsics can </span></span></span></span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>compare two numbers and return the larger.</span></span></span></span></span></span></div><div><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>There are the changes I do as fllowing.</span></span></span></span></span></span></div><div><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><br></span></span></span></span></span></span></div><div><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>In /tools/clang/include/clang/Basic/BuiltinsX86.def :<br></span></span></span></span></span></span></div><div>BUILTIN(__builtin_x86_max_qb, "iii", "") <br></div><div>In include/llvm/IR/IntrinsicsX86.td :<br></div><div> let TargetPrefix = "x86" in {<br> def int_x86_max_qb: GCCBuiltin<"__builtin_x86_max_qb">,<br>  Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [<code class="m_8746401474559925857language-cpp m_8746401474559925857hljs">IntrNoMem</code>]>;<br>}</div><div>In /lib/Target/X86/X86SelLowering.h: add a sdnode</div><div>    max_qb,<br></div><div>In /lib/Target/X86/X86SelLowering.cpp: <br></div><div>case X86ISD::max_qb:             return "X86ISD::max_qb";</div><div>In /lib/Target/X86/X86InstrInfo.td:</div><div>def X86max_qb_flag : SDNode<"X86ISD::max_qb", SDTBinaryArithWithFlags,<br>                          [SDNPCommutative]>;</div><div>In /lib/Target/X86/X86InstrArithmetic.td:</div><div>def max_qb : I<0xff,MRMSrcReg, (outs  GR32:$dst), (ins GR32:$src1,GR32:$src2),<br>             "max_qb\t {$dst, $src1,$src2|$src1,$src2, $dst}", [(set GR32:$dst,EFLAGS,(X86max_qb_flag GR32:$src1, GR32:$src2))]>,<br>              Sched<[WriteIMul]>, TB, OpSize32 ;<br></div><div>I think it can be work ,<span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span>at least work as one multiplication(because I use the</span></span><span id="m_8746401474559925857result_box" class="m_8746401474559925857short_text" lang="en"><span> Sched<[WriteIMul]>).</span></span></div><div>But there is an error :"error: use of unknown builtin '__builtin_x86_max_qb'". And I don't konw what I should do.</div><div>Thanks a lot.<br></div></div></div><br><br><span title="neteasefooter"><p><br> </p></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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br><br><span title="neteasefooter"><p><br/> </p></span>