<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [jsc] Add missing MacroAssemblerMIPS::or32() implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=169714#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [jsc] Add missing MacroAssemblerMIPS::or32() implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=169714">bug 169714</a>
              from <span class="vcard"><a class="email" href="mailto:guijemont&#64;igalia.com" title="Guillaume Emont &lt;guijemont&#64;igalia.com&gt;"> <span class="fn">Guillaume Emont</span></a>
</span></b>
        <pre>(In reply to Adrian Perez from <a href="show_bug.cgi?id=169714#c2">comment #2</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=304573&amp;action=diff" name="attach_304573" title="Patch">attachment 304573</a> <a href="attachment.cgi?id=304573&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=304573&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=304573&amp;action=review</a>
&gt; 
&gt; Reviewing informally: The comparisons should treat immediate value
&gt; zero as a 16-bit value which gets embedded in an “ori” instruction.
&gt; Other than that looks good overall.
&gt; 
&gt; There is the thing that I would prefer using constants from “stdint.h” or
&gt; masking with 0xFFFF to check for values outside of the 16-bit range, but
&gt; the rest of the code in the file compares directly against the numeric
&gt; values, so I don't have a strong feeling about that. It might be a good
&gt; idea to do change the code to use [U]INTx_{MIN,MAX} or bitmaks, as a
&gt; separate patch. WDYT?
&gt; 
&gt; &gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:448
&gt; &gt; +        if (address.offset &gt;= -32768 &amp;&amp; address.offset &lt;= 32767
&gt; 
&gt; Personally, I would write this condition as...
&gt; 
&gt;       if (address.offset &amp; 0xFFFF == 0 &amp;&amp; ...)
&gt; 
&gt; ...because when reading this form it makes me think “this checks whether
&gt; the upper 16-bits are unset”. On the other hand, comparisons against the
&gt; integral values keep me wondering “wait, why is there a magic number here?”.
&gt; 
&gt; I have no strong opinion about whether to use the bitmask version or the
&gt; integer comparison, but if you would rather keep the integer comparison,
&gt; please use INT16_MIN/INT16_MAX, which makes it more explicit that values
&gt; outside the 16-bit integer range are being handled:
&gt; 
&gt;        if (address.offset &gt;= INT16_MIN &amp;&amp; address.offset &lt;= INT16_MAX &amp;&amp; ...)
&gt; </span >
Indeed, this would be clearer, especially with the bitmask I'd think. I'll create a separate bug and try to address that for the whole file.


<span class="quote">&gt; &gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:457
&gt; &gt; +            if (imm.m_value &gt; 0 &amp;&amp; imm.m_value &lt;= 65535 &amp;&amp; !m_fixedWidth)
&gt; 
&gt; This should be “greater or equal to zero”, not just ”greater than zero”:
&gt; 
&gt;      if (imm.m_value &gt;= 0 &amp;&amp; imm.m_value &lt;= UINT16_MAX ...)
&gt;   or if (imm.m_value &amp; 0xFFFF == 0 ...)
&gt; 
&gt; If the immediate value is equal to zero, emitting the code for ORing
&gt; could even be skipped altogether. Though I would do that separately
&gt; on another patch.</span >
I am cooking a patch that address this issues. Here again, I just copy-pasted from another version of the function, and that issue is a bit everywhere in the file and deserves its own bug I guess.

<span class="quote">&gt; 
&gt; &gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:477
&gt; &gt; +            if (imm.m_value &gt; 0 &amp;&amp; imm.m_value &lt;= 65535 &amp;&amp; !m_fixedWidth)
&gt; 
&gt; Ditto: if (imm.m_value &gt;= 0 &amp;&amp; imm.m_value &lt;= UINT16_MAX ...)
&gt;                        ^^
&gt;                  greater or equal</span ></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>