Title: [278769] trunk/Source/_javascript_Core
Revision
278769
Author
commit-qu...@webkit.org
Date
2021-06-11 11:26:55 -0700 (Fri, 11 Jun 2021)

Log Message

Air ARM64 sub32 opcode should indicate that it zero-extends its result
https://bugs.webkit.org/show_bug.cgi?id=226849

Patch by Yijia Huang <yijia_hu...@apple.com> on 2021-06-11
Reviewed by Saam Barati.

Sub32 was previously not saying that its result is zero defined. However,
sub32 on arm64 architectures zero defines its result, so the top 32 bits
are zeroed. The issue with this is what we were not eliding provably
redundant zero extend operations.

For example:
// B3 IR
@0 = Trunc(ArgumentReg(0))
@1 = Trunc(ArgumentReg(1))
@2 = Sub(@0, @1)
@3 = ZExt32(@2) // i64
@4 = Return(@3) or Store(@3, @x)

// Old optimized Air IR
Sub32 %x0, %x1, %x0, b@2
Move32 %x0, %x0, b@3
Ret64 %x0, b@4 or Move %x0, (%x), b@4

To remove that redundant zero extend instruction (Move32), Air arm64
sub32 opcode should indicate that it zero-extends its result.

// New optimized Air IR
Sub32 %x0, %x1, %x0, b@2
Ret64 %x0, b@6 or Move %x0, (%x), b@4

* b3/air/AirOpcode.opcodes:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (278768 => 278769)


--- trunk/Source/_javascript_Core/ChangeLog	2021-06-11 18:08:32 UTC (rev 278768)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-06-11 18:26:55 UTC (rev 278769)
@@ -1,3 +1,37 @@
+2021-06-11  Yijia Huang  <yijia_hu...@apple.com>
+
+        Air ARM64 sub32 opcode should indicate that it zero-extends its result
+        https://bugs.webkit.org/show_bug.cgi?id=226849
+
+        Reviewed by Saam Barati.
+
+        Sub32 was previously not saying that its result is zero defined. However,
+        sub32 on arm64 architectures zero defines its result, so the top 32 bits
+        are zeroed. The issue with this is what we were not eliding provably
+        redundant zero extend operations.
+
+        For example:
+        // B3 IR
+        @0 = Trunc(ArgumentReg(0))
+        @1 = Trunc(ArgumentReg(1))
+        @2 = Sub(@0, @1)
+        @3 = ZExt32(@2) // i64
+        @4 = Return(@3) or Store(@3, @x)
+
+        // Old optimized Air IR
+        Sub32 %x0, %x1, %x0, b@2
+        Move32 %x0, %x0, b@3
+        Ret64 %x0, b@4 or Move %x0, (%x), b@4
+
+        To remove that redundant zero extend instruction (Move32), Air arm64 
+        sub32 opcode should indicate that it zero-extends its result.
+
+        // New optimized Air IR
+        Sub32 %x0, %x1, %x0, b@2
+        Ret64 %x0, b@6 or Move %x0, (%x), b@4
+
+        * b3/air/AirOpcode.opcodes:
+
 2021-06-10  Keith Miller  <keith_mil...@apple.com>
 
         Shouldn't drain the micro task queue when calling out to ObjC

Modified: trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes (278768 => 278769)


--- trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes	2021-06-11 18:08:32 UTC (rev 278768)
+++ trunk/Source/_javascript_Core/b3/air/AirOpcode.opcodes	2021-06-11 18:26:55 UTC (rev 278769)
@@ -177,7 +177,7 @@
     x86: Tmp, Addr
     x86: Tmp, Index
 
-arm64: Sub32 U:G:32, U:G:32, D:G:32
+arm64: Sub32 U:G:32, U:G:32, ZD:G:32
     Tmp, Tmp, Tmp
 
 64: Sub64 U:G:64, UD:G:64
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to