<?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>264984</bug_id>
          
          <creation_ts>2023-11-16 14:59:15 -0800</creation_ts>
          <short_desc>[JSC] Refine B3 and masm tests for EXTR pattern detection and application</short_desc>
          <delta_ts>2024-02-06 09:24:16 -0800</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="Yijia Huang">yijia_huang</reporter>
          <assigned_to name="Yijia Huang">yijia_huang</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1993254</commentid>
    <comment_count>0</comment_count>
    <who name="Yijia Huang">yijia_huang</who>
    <bug_when>2023-11-16 14:59:15 -0800</bug_when>
    <thetext>Also need to add these test cases.

--- a/Source/JavaScriptCore/b3/testb3_2.cpp
+++ b/Source/JavaScriptCore/b3/testb3_2.cpp
@@ -4883,7 +4883,7 @@ void testExtractRegister32()
 {
     if (JSC::Options::defaultB3OptLevel() &lt; 2)
         return;    
-    Vector&lt;uint32_t&gt; lowWidths = { 0, 17, 31 };
+    Vector&lt;uint32_t&gt; lowWidths = { 0, 17, 31, 32 };
 
     // Test Pattern: ((n &amp; mask1) &lt;&lt; highWidth) | ((m &amp; mask2) &gt;&gt; lowWidth)
     // Where: highWidth = datasize - lowWidth
@@ -4915,7 +4915,7 @@ void testExtractRegister32()
             root-&gt;appendNew&lt;Value&gt;(proc, BitOr, Origin(), left, right));
 
         auto code = compileProc(proc);
-        if (isARM64() &amp;&amp; lowWidth &gt; 0)
+        if (isARM64() &amp;&amp; 0 &lt; lowWidth &amp;&amp; lowWidth &lt; 32)
             checkUsesInstruction(*code, &quot;extr&quot;);
         return invoke&lt;uint32_t&gt;(*code, n, m);
     };
@@ -4943,7 +4943,7 @@ void testExtractRegister64()
 {
     if (JSC::Options::defaultB3OptLevel() &lt; 2)
         return;    
-    Vector&lt;uint64_t&gt; lowWidths = { 0, 34, 63 };
+    Vector&lt;uint64_t&gt; lowWidths = { 0, 34, 63, 64 };
 
     // Test Pattern: ((n &amp; mask1) &lt;&lt; highWidth) | ((m &amp; mask2) &gt;&gt; lowWidth)
     // Where: highWidth = datasize - lowWidth
@@ -4971,7 +4971,7 @@ void testExtractRegister64()
             root-&gt;appendNew&lt;Value&gt;(proc, BitOr, Origin(), left, right));
 
         auto code = compileProc(proc);
-        if (isARM64() &amp;&amp; lowWidth &gt; 0)
+        if (isARM64() &amp;&amp; 0 &lt; lowWidth &amp;&amp; lowWidth &lt; 64)
             checkUsesInstruction(*code, &quot;extr&quot;);
         return invoke&lt;uint64_t&gt;(*code, n, m);
     };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1993256</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-11-16 14:59:59 -0800</bug_when>
    <thetext>&lt;rdar://problem/118532295&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010441</commentid>
    <comment_count>2</comment_count>
    <who name="Yijia Huang">yijia_huang</who>
    <bug_when>2024-02-03 17:09:04 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/23820</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2011030</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-06 09:24:14 -0800</bug_when>
    <thetext>Committed 274149@main (084df28f4fc4): &lt;https://commits.webkit.org/274149@main&gt;

Reviewed commits have been landed. Closing PR #23820 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>