<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=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</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=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>movhi means mov if unsigned Higher<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>movls means mov if unsigned Lower or Same<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>so depending on the comparison result r0 holds 1 or 0<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Rodolph.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><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>Nick Lewycky<br>
<b>Sent:</b> 08 April 2010 06:51<br>
<b>To:</b> LLVM Developers Mailing List<br>
<b>Cc:</b> Steve Canon<br>
<b>Subject:</b> [LLVMdev] compiler-rt's arm vfp o<= implementation<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>The implementation of an float ordered <= looks buggy,
but maybe I'm not reading the assembly right. This is lesf2vfp.S in
compiler-rt, and it has this code:<o:p></o:p></p>

<div><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>// extern int __lesf2vfp(float a, float b);<o:p></o:p></pre><pre>//<o:p></o:p></pre><pre>// Returns one iff a <= b and neither is NaN.<o:p></o:p></pre><pre>// Uses Darwin calling convention where single precision arguments are passsed <o:p></o:p></pre><pre>// like 32-bit ints<o:p></o:p></pre><pre>//<o:p></o:p></pre><pre>DEFINE_COMPILERRT_FUNCTION(__lesf2vfp)<o:p></o:p></pre><pre>       fmsr    s14, r0     // move from GPR 0 to float register<o:p></o:p></pre><pre>       fmsr    s15, r1     // move from GPR 1 to float register<o:p></o:p></pre><pre>       fcmps   s14, s15<o:p></o:p></pre><pre>       fmstat<o:p></o:p></pre><pre>       movls   r0, #1      // set result register to 1 if equal<o:p></o:p></pre><pre>       movhi   r0, #0<o:p></o:p></pre><pre>       bx      lr<o:p></o:p></pre>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>If I read
this right, the high bits of r0 are always cleared (by the movhi) while the low
bits are conditionally set to 1 (by the movls), but there's nothing to clear
the r0's low bits in the false case. Is this a bug or have I misunderstood the
assembly?<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>Nick<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><o:p> </o:p></span></p>

</div>

</div>

</div>

</div>

</body>

</html>