<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=iso-2022-jp">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"MS PGothic";
        panose-1:2 11 6 0 7 2 5 8 2 4;}
@font-face
        {font-family:"Meiryo UI";
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@Meiryo UI";
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS PGothic";
        panose-1:2 11 6 0 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"MS PGothic","sans-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;}
p
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"MS PGothic","sans-serif";}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
p.xmsochpdefault, li.xmsochpdefault, div.xmsochpdefault
        {mso-style-name:x_msochpdefault;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri","sans-serif";}
span.xmsohyperlink
        {mso-style-name:x_msohyperlink;
        color:blue;
        text-decoration:underline;}
span.xmsohyperlinkfollowed
        {mso-style-name:x_msohyperlinkfollowed;
        color:purple;
        text-decoration:underline;}
span.xemailstyle17
        {mso-style-name:x_emailstyle17;
        font-family:"Meiryo UI","sans-serif";
        color:black;
        font-weight:normal;
        font-style:normal;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Meiryo UI","sans-serif";
        color:black;
        font-weight:normal;
        font-style:normal;}
.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-PH" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black">Hello Sjoerd,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black">Although this is a solution that may fix our problem, our target architecture specifies that operations for types i32, i64, f32, and f64 are supported by using
 emulation routines/libraries. Considering this specification, there is a need to define the i32 and i64 operations (as custom library calls) that are not defined in the generic library calls.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black">Thank you for helping!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black">Miguel<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Meiryo UI","sans-serif";color:black"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Sjoerd Meijer [mailto:Sjoerd.Meijer@arm.com]
<br>
<b>Sent:</b> March 02, 2020 7:30 PM<br>
<b>To:</b> llvm-dev; Miguel Inigo J. Manalac<br>
<b>Subject:</b> Re: RTLIB and Custom Library calls<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">If you're looking for examples, I think most backends will generate libcalls (for things they don't support). I don't look at other backends too much, but perhaps a simple example
 from the ARM backend is compiling this example:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">double foo(double a, double b) {<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">  return a < b;<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">for a core that doesn't support natively double precision operations (e.g. compile with --target=arm-arm--eabihf -mcpu=cortex-m4). If you request debug and -print-after-all on
 the command line, you can trace where the different things get introduced and generated. For this fcmp example in the ARM backend, you will see that it all kind of starts with describing the SETCC operation, which generates this fcmp, to "expand" for the f64
 data type. This is picked up by the generic type legalizer, which will query backends to see if it e.g. needs to "soften" float operands. Also, in the backend you will see mappings from the generic library calls, to the target specific libcalls. This is a
 very briefly description, but I don't think it works much different for other cases. For the i64 cases, you perhaps don't need libcalls as it can be done with 32-bit instruction, like in the ARM backed.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">There have been quite a number of talks on how writing your own backend on the llvm dev conferences. Although I haven't checked, I guess they they spent some slides on this, so
 perhaps you can get some inspiration from there.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black">Hope this helps a bit.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Miguel
 Inigo J. Manalac via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> 02 March 2020 07:33<br>
<b>To:</b> llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> [llvm-dev] RTLIB and Custom Library calls</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Hello LLVM-Dev,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Most of the processing for i64 and f64 types for our backend are emulation library calls. Some of the library calls are not defined in the RuntimeLibcalls.def Libcall enum
 so we have to define custom library calls. </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">How is the ideal way of implementing the custom library calls? Providing us with a target backend having a similar functionality would also help us significantly.</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Say for a i64 type compare, does adding it in the RuntimeLibcalls.def enum, SelectionDAGLegalize::ConvertNodeToLibcall function, and the target ISelLowering Class solve our
 problem?</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Is it okay to modify RuntimeLibcalls.def and SelectionDAGLegalize::ConvertNodeToLibcall function?</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">A starting point for processing lib calls other than the ISelLowering class would also help!</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Thank you in advance for your help!</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black"> </span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Sincerely,</span><o:p></o:p></p>
<p class="xmsonormal"><span style="font-family:"Meiryo UI","sans-serif";color:black">Miguel Inigo J. Manalac (1852)</span><o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal">JAPANESE: <span lang="JA">$B$3$N%a!<%k$O!"08@h$K=q$+$l$F$$$kJ}$N$_$KAw?.$9$k$3$H$r0U?^$7$F$*$j$^$9!#8m$C$F$=$l0J30$NJ}$KAw?.$5$l$?>l9g$O!"?=$7Lu$4$6$$$^$;$s$,!"Aw?.<T$^$G$*CN$i$;$$$?$@$-!"<u?.$5$l$?%a!<%k$r:o=|$7$F$$$?$@$-$^$9$h$&$*4j$$$$$?$7$^$9!#$^$?!"%3%s%T%e!<%?!&%&%#%k%9$N:.F~Ey$K$h$C$F%a!<%k$N7gMn!&IT@09g!&CYBZEy$,H/@8$7!"2?$i$N$4ITJX$r$*$+$1$9$k$3$H$,@8$8$F$bJ@<R$O$=$N@UG$$rIi$$$^$;$s!#(B</span> ENGLISH: This e-mail
 is intended for the person(s) to which it is addressed. If you have received it by mistake, please notify the sender and delete the received email. In addition, our company shall not assume any responsibility even if it causes any inconvenience, such as loss
 of mail, inconsistencies, delays, etc., due to the inclusion of computer viruses.
<o:p></o:p></p>
</div>
</div>
JAPANESE: $B$3$N%a!<%k$O!"08@h$K=q$+$l$F$$$kJ}$N$_$KAw?.$9$k$3$H$r0U?^$7$F$*$j$^$9!#8m$C$F$=$l0J30$NJ}$KAw?.$5$l$?>l9g$O!"?=$7Lu$4$6$$$^$;$s$,!"Aw?.<T$^$G$*CN$i$;$$$?$@$-!"<u?.$5$l$?%a!<%k$r:o=|$7$F$$$?$@$-$^$9$h$&$*4j$$$$$?$7$^$9!#$^$?!"%3%s%T%e!<%?!&%&%#%k%9$N:.F~Ey$K$h$C$F%a!<%k$N7gMn!&IT@09g!&CYBZEy$,H/@8$7!"2?$i$N$4ITJX$r$*$+$1$9$k$3$H$,@8$8$F$bJ@<R$O$=$N@UG$$rIi$$$^$;$s!#(B ENGLISH: This e-mail is intended for the person(s) to which it
 is addressed. If you have received it by mistake, please notify the sender and delete the received email. In addition, our company shall not assume any responsibility even if it causes any inconvenience, such as loss of mail, inconsistencies, delays, etc.,
 due to the inclusion of computer viruses.
</body>
</html>