⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278769 in webkit


Ignore:
Timestamp:
Jun 11, 2021, 11:26:55 AM (5 years ago)
Author:
commit-queue@webkit.org
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 Huang> 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:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r278734 r278769  
     12021-06-11  Yijia Huang  <yijia_huang@apple.com>
     2
     3        Air ARM64 sub32 opcode should indicate that it zero-extends its result
     4        https://bugs.webkit.org/show_bug.cgi?id=226849
     5
     6        Reviewed by Saam Barati.
     7
     8        Sub32 was previously not saying that its result is zero defined. However,
     9        sub32 on arm64 architectures zero defines its result, so the top 32 bits
     10        are zeroed. The issue with this is what we were not eliding provably
     11        redundant zero extend operations.
     12
     13        For example:
     14        // B3 IR
     15        @0 = Trunc(ArgumentReg(0))
     16        @1 = Trunc(ArgumentReg(1))
     17        @2 = Sub(@0, @1)
     18        @3 = ZExt32(@2) // i64
     19        @4 = Return(@3) or Store(@3, @x)
     20
     21        // Old optimized Air IR
     22        Sub32 %x0, %x1, %x0, b@2
     23        Move32 %x0, %x0, b@3
     24        Ret64 %x0, b@4 or Move %x0, (%x), b@4
     25
     26        To remove that redundant zero extend instruction (Move32), Air arm64
     27        sub32 opcode should indicate that it zero-extends its result.
     28
     29        // New optimized Air IR
     30        Sub32 %x0, %x1, %x0, b@2
     31        Ret64 %x0, b@6 or Move %x0, (%x), b@4
     32
     33        * b3/air/AirOpcode.opcodes:
     34
    1352021-06-10  Keith Miller  <keith_miller@apple.com>
    236
  • trunk/Source/JavaScriptCore/b3/air/AirOpcode.opcodes

    r270214 r278769  
    178178    x86: Tmp, Index
    179179
    180 arm64: Sub32 U:G:32, U:G:32, D:G:32
     180arm64: Sub32 U:G:32, U:G:32, ZD:G:32
    181181    Tmp, Tmp, Tmp
    182182
Note: See TracChangeset for help on using the changeset viewer.