<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>170089</bug_id>
          
          <creation_ts>2017-03-24 17:16:02 -0700</creation_ts>
          <short_desc>[jsc][mips] Add missing MacroAssembler functions after r214187</short_desc>
          <delta_ts>2017-04-11 05:44:52 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Other</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Guillaume Emont">guijemont</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>annulen</cc>
    
    <cc>aperez</cc>
    
    <cc>buildbot</cc>
    
    <cc>commit-queue</cc>
    
    <cc>guijemont</cc>
    
    <cc>jbriance</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1291094</commentid>
    <comment_count>0</comment_count>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-03-24 17:16:02 -0700</bug_when>
    <thetext>We need to implement MacroAssemblerMIPS::loadFloat() and storeFloat() with an ImplicitAddress argument.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1291117</commentid>
    <comment_count>1</comment_count>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-03-24 18:56:52 -0700</bug_when>
    <thetext>I am currently testing a patch that I will submit for revision once I&apos;m confident it doesn&apos;t break anything (likely on Monday).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1291669</commentid>
    <comment_count>2</comment_count>
      <attachid>305523</attachid>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-03-27 16:26:24 -0700</bug_when>
    <thetext>Created attachment 305523
Patch

The patch. It does not seem to break anything.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293609</commentid>
    <comment_count>3</comment_count>
      <attachid>305523</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-04-03 01:11:27 -0700</bug_when>
    <thetext>Comment on attachment 305523
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305523&amp;action=review

r=me with comment.

&gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462
&gt; +    void loadFloat(ImplicitAddress address, FPRegisterID dest)
&gt; +    {
&gt; +        if (address.offset &gt;= -32768 &amp;&amp; address.offset &lt;= 32767
&gt; +            &amp;&amp; !m_fixedWidth) {
&gt; +            m_assembler.lwc1(dest, address.base, address.offset);
&gt; +        } else {
&gt; +            /*
&gt; +               lui     addrTemp, (offset + 0x8000) &gt;&gt; 16
&gt; +               addu    addrTemp, addrTemp, base
&gt; +               lwc1    dest, (offset &amp; 0xffff)(addrTemp)
&gt; +               */
&gt; +            m_assembler.lui(addrTempRegister, (address.offset + 0x8000) &gt;&gt; 16);
&gt; +            m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
&gt; +            m_assembler.lwc1(dest, addrTempRegister, address.offset);
&gt; +        }
&gt; +    }

Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard.
Isn&apos;t it required here?

&gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2617
&gt; +    }

Ditto.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294019</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-04 04:21:25 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #3)
&gt; Comment on attachment 305523 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=305523&amp;action=review
&gt; 
&gt; r=me with comment.
&gt; 
&gt; &gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462
&gt; &gt; +    void loadFloat(ImplicitAddress address, FPRegisterID dest)
&gt; &gt; +    {
&gt; &gt; +        if (address.offset &gt;= -32768 &amp;&amp; address.offset &lt;= 32767
&gt; &gt; +            &amp;&amp; !m_fixedWidth) {
&gt; &gt; +            m_assembler.lwc1(dest, address.base, address.offset);
&gt; &gt; +        } else {
&gt; &gt; +            /*
&gt; &gt; +               lui     addrTemp, (offset + 0x8000) &gt;&gt; 16
&gt; &gt; +               addu    addrTemp, addrTemp, base
&gt; &gt; +               lwc1    dest, (offset &amp; 0xffff)(addrTemp)
&gt; &gt; +               */
&gt; &gt; +            m_assembler.lui(addrTempRegister, (address.offset + 0x8000) &gt;&gt; 16);
&gt; &gt; +            m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
&gt; &gt; +            m_assembler.lwc1(dest, addrTempRegister, address.offset);
&gt; &gt; +        }
&gt; &gt; +    }
&gt; 
&gt; Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard.
&gt; Isn&apos;t it required here?

I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In
MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly,
but in MIPS-I it is needed to use two “lwc1” instructions, one for
each 32-bit half of the 64-bit value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294771</commentid>
    <comment_count>5</comment_count>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-04-05 19:25:47 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #4)
&gt; (In reply to Yusuke Suzuki from comment #3)
&gt; &gt; Comment on attachment 305523 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=305523&amp;action=review
&gt; &gt; 
&gt; &gt; r=me with comment.
&gt; &gt; 
&gt; &gt; &gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462
&gt; &gt; &gt; +    void loadFloat(ImplicitAddress address, FPRegisterID dest)
&gt; &gt; &gt; +    {
&gt; &gt; &gt; +        if (address.offset &gt;= -32768 &amp;&amp; address.offset &lt;= 32767
&gt; &gt; &gt; +            &amp;&amp; !m_fixedWidth) {
&gt; &gt; &gt; +            m_assembler.lwc1(dest, address.base, address.offset);
&gt; &gt; &gt; +        } else {
&gt; &gt; &gt; +            /*
&gt; &gt; &gt; +               lui     addrTemp, (offset + 0x8000) &gt;&gt; 16
&gt; &gt; &gt; +               addu    addrTemp, addrTemp, base
&gt; &gt; &gt; +               lwc1    dest, (offset &amp; 0xffff)(addrTemp)
&gt; &gt; &gt; +               */
&gt; &gt; &gt; +            m_assembler.lui(addrTempRegister, (address.offset + 0x8000) &gt;&gt; 16);
&gt; &gt; &gt; +            m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
&gt; &gt; &gt; +            m_assembler.lwc1(dest, addrTempRegister, address.offset);
&gt; &gt; &gt; +        }
&gt; &gt; &gt; +    }
&gt; &gt; 
&gt; &gt; Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard.
&gt; &gt; Isn&apos;t it required here?
&gt; 
&gt; I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In
&gt; MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly,
&gt; but in MIPS-I it is needed to use two “lwc1” instructions, one for
&gt; each 32-bit half of the 64-bit value.

No, I don&apos;t think we need that guard. loadDouble/storeDouble use that because MIPS-I does not contain the ldc1 (resp. sdc1) instruction, and therefore two lwc1 (resp swc1) instructions are used instead for the MIPS-I version. In loadFloat/storeFloat, we do not use ldc1/sdc1, and all the instructions that we use are MIPS-I compatible AFAIK, so there&apos;s no need for an alternative version.
You can see that the pre-existing loadFloat/storeFloat with a BaseIndex argument don&apos;t have such a guard either, for the same reasons.

Another way to put it: the need for special cases for MIPS-I only exists when dealing with doubles. The fact of using an ImplicitAddress instead of a BaseIndex does not incur this need. 

Another debate is whether we still want to support MIPS-I, I don&apos;t know if there still are many devices using that where it makes sense to use webkit, though I could be wrong, because, hey, we have these guards in the code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294849</commentid>
    <comment_count>6</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-06 04:01:04 -0700</bug_when>
    <thetext>(In reply to Guillaume Emont from comment #5)

&gt; Another way to put it: the need for special cases for MIPS-I only exists
&gt; when dealing with doubles. The fact of using an ImplicitAddress instead of a
&gt; BaseIndex does not incur this need. 

Oh, I was assuming that loadFloat() would emit a load for a 64-bit value.
Thanks for clarifying.

Then you&apos;re right (and I should have checked the code before commenting)
and it&apos;s an r+me :-)

&gt; Another debate is whether we still want to support MIPS-I, I don&apos;t know if
&gt; there still are many devices using that where it makes sense to use webkit,
&gt; though I could be wrong, because, hey, we have these guards in the code.

The cost of maintaining MIPS-I support is quite low:

  ~/devel/WebKit % rg -F &apos;WTF_MIPS_ISA(1)&apos; Source | wc -l
  8

There&apos;s only the code for emitting load/save of 64-bit floating point values
in “MacroAssemblerMIPS.h”, and two one-liners to insert “nop”-delays after
some load instructions.

It does not seem that it is much of a problem to keep the support around,
though it&apos;s difficult to gauge how often JSC ends up running on MIPS-I
hardware. As far as I know that would be only the original R2000/R3000
CPUs, and more recently clones (e.g. OpenCores has a synthetizable clean
room design) often used as microcontrollers — so I have no strong opinion
towards keeping the MIPS-I bits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296358</commentid>
    <comment_count>7</comment_count>
      <attachid>305523</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-04-11 05:16:16 -0700</bug_when>
    <thetext>Comment on attachment 305523
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305523&amp;action=review

&gt;&gt;&gt;&gt; Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462
&gt;&gt;&gt;&gt; +    }
&gt;&gt;&gt; 
&gt;&gt;&gt; Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard.
&gt;&gt;&gt; Isn&apos;t it required here?
&gt;&gt; 
&gt;&gt; I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In
&gt;&gt; MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly,
&gt;&gt; but in MIPS-I it is needed to use two “lwc1” instructions, one for
&gt;&gt; each 32-bit half of the 64-bit value.
&gt; 
&gt; No, I don&apos;t think we need that guard. loadDouble/storeDouble use that because MIPS-I does not contain the ldc1 (resp. sdc1) instruction, and therefore two lwc1 (resp swc1) instructions are used instead for the MIPS-I version. In loadFloat/storeFloat, we do not use ldc1/sdc1, and all the instructions that we use are MIPS-I compatible AFAIK, so there&apos;s no need for an alternative version.
&gt; You can see that the pre-existing loadFloat/storeFloat with a BaseIndex argument don&apos;t have such a guard either, for the same reasons.
&gt; 
&gt; Another way to put it: the need for special cases for MIPS-I only exists when dealing with doubles. The fact of using an ImplicitAddress instead of a BaseIndex does not incur this need. 
&gt; 
&gt; Another debate is whether we still want to support MIPS-I, I don&apos;t know if there still are many devices using that where it makes sense to use webkit, though I could be wrong, because, hey, we have these guards in the code.

Make sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296364</commentid>
    <comment_count>8</comment_count>
      <attachid>305523</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-04-11 05:44:50 -0700</bug_when>
    <thetext>Comment on attachment 305523
Patch

Clearing flags on attachment: 305523

Committed r215226: &lt;http://trac.webkit.org/changeset/215226&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296365</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-04-11 05:44:52 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>305523</attachid>
            <date>2017-03-27 16:26:24 -0700</date>
            <delta_ts>2017-04-11 05:44:50 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-170089-20170327182623.patch</filename>
            <type>text/plain</type>
            <size>2819</size>
            <attacher name="Guillaume Emont">guijemont</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE0MzI4CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCA2
ZjlhM2YzMWU3ZmVjNjBmYzFhMTM0ZTdhOTMxZjI5MmZjYTZjNWZmLi5mNTMzZDY5MWYzMTIxOTEy
ODZjZGIwNjYzZTcxZDQyMzA3ODljYjhmIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNCBAQAorMjAxNy0wMy0yNyAgR3VpbGxhdW1lIEVtb250ICA8Z3VpamVtb250QGlnYWxp
YS5jb20+CisKKyAgICAgICAgW2pzY11bbWlwc10gQWRkIG1pc3NpbmcgTWFjcm9Bc3NlbWJsZXIg
ZnVuY3Rpb25zIGFmdGVyIHIyMTQxODcKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcv
c2hvd19idWcuY2dpP2lkPTE3MDA4OQorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09Q
UyEpLgorCisgICAgICAgICogYXNzZW1ibGVyL01hY3JvQXNzZW1ibGVyTUlQUy5oOgorICAgICAg
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peGVkV2lkdGgpCisgICAgICAgICAgICBtX2Fzc2VtYmxlci5zd2MxKHNy
YywgYWRkcmVzcy5iYXNlLCBhZGRyZXNzLm9mZnNldCk7CisgICAgICAgIGVsc2UgeworICAgICAg
ICAgICAgLyoKKyAgICAgICAgICAgICAgICBsdWkgICAgIGFkZHJUZW1wLCAob2Zmc2V0ICsgMHg4
MDAwKSA+PiAxNgorICAgICAgICAgICAgICAgIGFkZHUgICAgYWRkclRlbXAsIGFkZHJUZW1wLCBi
YXNlCisgICAgICAgICAgICAgICAgc3djMSAgICBzcmMsIChvZmZzZXQgJiAweGZmZmYpKGFkZHJU
ZW1wKQorICAgICAgICAgICAgICAqLworICAgICAgICAgICAgbV9hc3NlbWJsZXIubHVpKGFkZHJU
ZW1wUmVnaXN0ZXIsIChhZGRyZXNzLm9mZnNldCArIDB4ODAwMCkgPj4gMTYpOworICAgICAgICAg
ICAgbV9hc3NlbWJsZXIuYWRkdShhZGRyVGVtcFJlZ2lzdGVyLCBhZGRyVGVtcFJlZ2lzdGVyLCBh
ZGRyZXNzLmJhc2UpOworICAgICAgICAgICAgbV9hc3NlbWJsZXIuc3djMShzcmMsIGFkZHJUZW1w
UmVnaXN0ZXIsIGFkZHJlc3Mub2Zmc2V0KTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHZvaWQg
c3RvcmVEb3VibGUoRlBSZWdpc3RlcklEIHNyYywgSW1wbGljaXRBZGRyZXNzIGFkZHJlc3MpCiAg
ICAgewogI2lmIFdURl9NSVBTX0lTQSgxKQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>