<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 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:"MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:MingLiU;
        panose-1:2 2 5 9 0 0 0 0 0 0;}
@font-face
        {font-family:MingLiU;
        panose-1:2 2 5 9 0 0 0 0 0 0;}
@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:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MingLiU";
        panose-1:2 2 5 9 0 0 0 0 0 0;}
@font-face
        {font-family:"\@MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* 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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-GB;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">The –soft-float option won't be necessary once FP16_TO_FP and FP_TO_FP16 are set to 'Expand' as Tim suggested. This will cause LLVM to replace these nodes with a libcall
 while everything else continues to use the hardware support.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">I believe you need to add these calls to MipsISelLowering.cpp:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">setOperationAction(ISD::FP16_TO_FP, MVT::f32, Expand); // Conversion from half -> float<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">setOperationAction(ISD::FP_TO_FP16, MVT::f32, Expand); // Conversion from float -> half<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">setOperationAction(ISD::FP16_TO_FP, MVT::f64, Expand); // Conversion from half -> double<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">setOperationAction(ISD::FP_TO_FP16, MVT::f64, Expand); // Conversion from double -> half<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<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""> llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>???<br>
<b>Sent:</b> 28 July 2014 09:21<br>
<b>To:</b> Jim Grosbach<br>
<b>Cc:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] FPU cannot be compatible with -soft-float code on mips by llc<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Jim,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">    X86 and ARM have the assembly instruction convert float to half/covert half to float, so they need not to call libcall, but MIPS have not.  So we must add -soft-float option. The terrible thing is all function will be using soft, not
 FPU (hard).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Robin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div class="MsoNormal">
<hr size="1" width="210" style="width:157.5pt" noshade="" style="color:#B5C4DF" align="left">
</div>
<div>
<div style="margin-left:7.5pt;margin-top:7.5pt;margin-right:7.5pt;margin-bottom:7.5pt">
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana","sans-serif""><a href="mailto:liuyalong.email@gmail.com" target="_blank">liuyalong.email@gmail.com</a><o:p></o:p></span></p>
</div>
</div>
</div>
<blockquote style="margin-left:6.0pt">
<div>
<p class="MsoNormal">  <o:p></o:p></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div>
<div>
<p class="MsoNormal" style="background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black">From:</span></b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black"> <a href="mailto:grosbach@apple.com" target="_blank">Jim
 Grosbach</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black">Date:</span></b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black"> <a href="tel:2014-07-25%C2%A010" target="_blank">2014-07-25 10</a>:50<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black">To:</span></b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black"> <a href="mailto:liuyalong.email@gmail.com" target="_blank"><span style="font-family:"MS Gothic"">刘</span><span style="font-family:MingLiU">亚龙</span></a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black">CC:</span></b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black"> <a href="mailto:llvmdev@cs.uiuc.edu" target="_blank">llvmdev</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black">Subject:</span></b><span style="font-size:9.0pt;font-family:"Tahoma","sans-serif";color:black"> Re: [LLVMdev] FPU cannot be compatible
 with -soft-float code on mips by llc<o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Hi Robin, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It sounds like you want to support half (f16 in LLVM terms) as a storage only interchange format. AArch64 and X86 (among others) do the same thing. You shouldn’t need the “-soft-float” option or anything of that nature at all. That, as
 you’ve found, disables all hard float operations. There’s been some recent cleanup in how this is handled in LLVM that should help guide you in what the Mips backend needs to do. In particular, Tim Northover’s recent patch, r213374.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  Jim<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Jul 24, 2014, at 6:32 PM, <span style="font-family:"MS Gothic"">
刘</span><span style="font-family:MingLiU">亚龙</span> <<a href="mailto:liuyalong.email@gmail.com" target="_blank">liuyalong.email@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">Hi all,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">    <span style="background:white">-soft-float can not be rightly use by llc. All float function operation will call soft float,
 but not hard.</span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">    My mips device cannot support half float type, so I hack the llvm, and add soft half float and add -soft-float option.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">    I add the function define for <span style="background:white">__gnu_f2h_ieee() and __gnu_h2f_ieee (), and it can call the
 soft half float.</span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">    However, all the others function about float also call the soft float, how I do make only <span style="background:white">__gnu_f2h_ieee()
 use soft float, other use hard float???</span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif""><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif"">    Thank you all !!<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif""><br>
<span style="background:white">Cheers, </span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="line-height:15.75pt;background:white"><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif";background:white">    Robin</span><span style="font-size:10.5pt;font-family:"Segoe UI","sans-serif""><o:p></o:p></span></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>