<?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>231159</bug_id>
          
          <creation_ts>2021-10-04 02:29:12 -0700</creation_ts>
          <short_desc>[JSC][ARMv7] Improve instruction selection in MacroAssembler</short_desc>
          <delta_ts>2022-03-24 03:34:21 -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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Geza Lore">glore</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>guijemont</cc>
    
    <cc>mikhail</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>xan.lopez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1799999</commentid>
    <comment_count>0</comment_count>
    <who name="Geza Lore">glore</who>
    <bug_when>2021-10-04 02:29:12 -0700</bug_when>
    <thetext>I have spotted some improvement opportunities in MacroAssemblerARMv7 for better instruction selection for some macros. What shows up most often in the disassembly (&apos;ip&apos; is &apos;r12&apos;):

mvn ip, #8
and r0, r0, ip

This is an 8-byte sequence which is equivalent to the following 2-byte instruction:

bic r0, #8


similarly:

mvn ip, #7
add r0, r0, ip

should be:

sub r0, r0, #8

A review of the disassembly would likely yield more examples of similar sequences where an immediate can be encoded cheaper using an alternative instruction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1801110</commentid>
    <comment_count>1</comment_count>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2021-10-06 08:53:32 -0700</bug_when>
    <thetext>(In reply to Geza Lore from comment #0)
&gt; I have spotted some improvement opportunities in MacroAssemblerARMv7 for
&gt; better instruction selection for some macros. What shows up most often in
&gt; the disassembly (&apos;ip&apos; is &apos;r12&apos;):
&gt; 
&gt; mvn ip, #8
&gt; and r0, r0, ip
&gt; 
&gt; This is an 8-byte sequence which is equivalent to the following 2-byte
&gt; instruction:
&gt; 
&gt; bic r0, #8
&gt; 
&gt; 
&gt; similarly:
&gt; 
&gt; mvn ip, #7
&gt; add r0, r0, ip
&gt; 
&gt; should be:
&gt; 
&gt; sub r0, r0, #8
&gt; 
&gt; A review of the disassembly would likely yield more examples of similar
&gt; sequences where an immediate can be encoded cheaper using an alternative
&gt; instruction.

Would any of this change the minimal version of the instruction set that we support? (not that I have it very clear in my mind what is our minimum currently).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1801136</commentid>
    <comment_count>2</comment_count>
    <who name="Geza Lore">glore</who>
    <bug_when>2021-10-06 09:32:00 -0700</bug_when>
    <thetext>Not these. BIC and SUB are as old as AND and ADD.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1802558</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-10-11 02:30:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/84091839&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1818711</commentid>
    <comment_count>4</comment_count>
    <who name="Geza Lore">glore</who>
    <bug_when>2021-11-30 07:21:03 -0800</bug_when>
    <thetext>Note https://bugs.webkit.org/show_bug.cgi?id=233474 implements the most frequent case of the mentioned add/sub exchange.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1854642</commentid>
    <comment_count>5</comment_count>
    <who name="Geza Lore">glore</who>
    <bug_when>2022-03-24 03:34:21 -0700</bug_when>
    <thetext>These have now been implemented in various patches</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>