<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>double foo(double a, double b) {<br>
</span>
<div>  return a < b;<br>
</div>
<span>}</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>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.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>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.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>Hope this helps a bit.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> 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</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"MS Mincho"}
@font-face
        {font-family:"MS Mincho"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:"Meiryo UI"}
@font-face
        {}
@font-face
        {}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.x_EmailStyle17
        {font-family:"Meiryo UI","sans-serif";
        color:black;
        font-weight:normal;
        font-style:normal}
.x_MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-PH" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black">Hello LLVM-Dev,</span></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black"> </span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black">Is it okay to modify RuntimeLibcalls.def and SelectionDAGLegalize::ConvertNodeToLibcall function?</span></p>
<p class="x_MsoNormal"><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></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black"> </span></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black">Thank you in advance for your help!</span></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black"> </span></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black">Sincerely,</span></p>
<p class="x_MsoNormal"><span style="font-family:"Meiryo UI","sans-serif"; color:black">Miguel Inigo J. Manalac (1852)</span></p>
<p class="x_MsoNormal"> </p>
</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. </div>
</body>
</html>