<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>I suspect that you almost certainly need to also implement a handler for this in the function ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>CodeGenFunction::EmitX86BuiltinExpr</span><span style='font-family:"Book Antiqua",serif;color:#C00000;mso-fareast-language:EN-US'>’ in:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>tools/clang/lib/CodeGen/CGBuiltin.cpp<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='text-indent:36.0pt'><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> cfe-dev [<a href="mailto:cfe-dev-bounces@lists.llvm.org">mailto:cfe-dev-bounces@lists.llvm.org</a>] <b>On Behalf Of </b>Seth Goldstein via cfe-dev<br><b>Sent:</b> 31 October 2017 22:20<br><b>To:</b> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br><b>Subject:</b> [cfe-dev] Adding an intrinsic that the user can include in source code<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>I would like to add an intrinsic that the user can put in their code.<o:p></o:p></p></div><div><p class=MsoNormal>The intrinsic is for sending, ala MPI, a value to another processor.<o:p></o:p></p></div><div><p class=MsoNormal>I have read the short document,<o:p></o:p></p></div><div><p class=MsoNormal><a href="https://llvm.org/docs/ExtendingLLVM.html">https://llvm.org/docs/ExtendingLLVM.html</a>, about adding intrinsics but<o:p></o:p></p></div><div><p class=MsoNormal>must be missing something because it doesn't mention changing anything<o:p></o:p></p></div><div><p class=MsoNormal>in clang.  I added my intrinsic to<o:p></o:p></p></div><div><p class=MsoNormal>llvm/include/llvm/IR/IntrinsicsX86.td, then I added it to<o:p></o:p></p></div><div><p class=MsoNormal>clang/include/clang/Basic/BuiltinsX86.def.  When I compile my code I get:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>send.c:14:3: error: cannot compile this builtin function yet<o:p></o:p></p></div><div><p class=MsoNormal>  __builtin_uli_send0(1, 0, &incr);<o:p></o:p></p></div><div><p class=MsoNormal>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The AST has information about my intrinsic and the parameters, but not<o:p></o:p></p></div><div><p class=MsoNormal>sure how to proceed.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>What am I missing?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><div><div><div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>--------------<o:p></o:p></p></div><div><p class=MsoNormal>Seth Copen Goldstein<o:p></o:p></p></div><div><p class=MsoNormal>Carnegie Mellon University<o:p></o:p></p></div><div><p class=MsoNormal>Computer Science Dept<o:p></o:p></p></div><div><p class=MsoNormal>7111 GHC<o:p></o:p></p></div><div><p class=MsoNormal>412-268-3828<o:p></o:p></p></div></div></div></div></div></div></div></div></body></html>