<div class="gmail_quote">On 8 April 2010 02:28, Rodolph Perfetta <span dir="ltr"><<a href="mailto:rodolph.perfetta@arm.com">rodolph.perfetta@arm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">movhi means mov if unsigned Higher</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">movls means mov if unsigned Lower or Same</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">so depending on the comparison result r0 holds 1 or 0</span></p></div></div></blockquote><div> </div><div>Thanks. Now that I understand the assembly, I think there's another problem. libgcc's definition of lesf2 is actually "1-(a<=b)". Source: <a href="http://www.google.com/codesearch/p?hl=en#ulemn8tW-hg/pub/gcc/releases/gcc-2.95.2/gcc-core-2.95.2.tar.gz%7CInAiOEw9K4g/gcc-2.95.2/gcc/libgcc1.c&q=libgcc1%20lesf2">http://www.google.com/codesearch/p?hl=en#ulemn8tW-hg/pub/gcc/releases/gcc-2.95.2/gcc-core-2.95.2.tar.gz%7CInAiOEw9K4g/gcc-2.95.2/gcc/libgcc1.c&q=libgcc1%20lesf2</a></div>
<div><br></div><div>Shih-wei wrote a patch which reverses the meaning of the predicate (attached) and this works for us. Is this okay to commit?</div><div><br></div><div>Nick</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple"><div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Rodolph.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </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">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a>
[mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank">llvmdev-bounces@cs.uiuc.edu</a>] <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</span></p>
</div>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </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:</p>
<div><pre> </pre><pre> </pre><pre>// extern int __lesf2vfp(float a, float b);</pre><pre>//</pre><pre>// Returns one iff a <= b and neither is NaN.</pre><pre>// Uses Darwin calling convention where single precision arguments are passsed </pre>
<pre>// like 32-bit ints</pre><pre>//</pre><pre>DEFINE_COMPILERRT_FUNCTION(__lesf2vfp)</pre><pre> fmsr s14, r0 // move from GPR 0 to float register</pre><pre> fmsr s15, r1 // move from GPR 1 to float register</pre>
<pre> fcmps s14, s15</pre><pre> fmstat</pre><pre> movls r0, #1 // set result register to 1 if equal</pre><pre> movhi r0, #0</pre><pre> bx lr</pre>
<div>
<p class="MsoNormal"><span>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?</span></p>
</div>
<div>
<p class="MsoNormal"><span> </span></p>
</div>
<div>
<p class="MsoNormal"><span>Nick</span></p>
</div>
<div>
<p class="MsoNormal"><span> </span></p>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br>