[webkit-changes] [WebKit/WebKit] 90a9fb: [JSC] Add "AddZeroExtend64" Air opcode
Yusuke Suzuki
noreply at github.com
Thu Dec 22 14:08:29 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 90a9fbb42e6a1cfc9d5b10de2480d59afefbfc70
https://github.com/WebKit/WebKit/commit/90a9fbb42e6a1cfc9d5b10de2480d59afefbfc70
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2022-12-22 (Thu, 22 Dec 2022)
Changed paths:
M Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
M Source/JavaScriptCore/b3/B3LowerToAir.cpp
M Source/JavaScriptCore/b3/air/AirInstInlines.h
M Source/JavaScriptCore/b3/air/AirOpcode.opcodes
M Source/JavaScriptCore/b3/testb3.h
M Source/JavaScriptCore/b3/testb3_1.cpp
M Source/JavaScriptCore/b3/testb3_7.cpp
M Source/JavaScriptCore/wasm/WasmAirIRGenerator64.cpp
Log Message:
-----------
[JSC] Add "AddZeroExtend64" Air opcode
https://bugs.webkit.org/show_bug.cgi?id=249765
rdar://103631099
Reviewed by Mark Lam.
In ARM64, we are leveraging LDR style address, which can take 32bit index in addressing and zero-extend / sign-extend that in load/store.
This is useful since WasmAddress' index is 32bit and we need to zero-extend it. However, we cannot use this addressing when there is an
offset since this addressing cannot encode offset. As a result, we are emitting Move32 and Add64 when there is an offset.
However, ARM64 can do even better for that case since ARM64 add / sub instructions also support LDR style extension.
This patch adds AddZeroExtend64 and AddSignExtend64. They take 32bit second operand and extend it before adding. This is particularly useful
when computing WasmAddress. We also leverage this in AirIRGenerator.
In the added testb3, the generated code is changed as follows.
Before:
O2: testWasmAddressWithOffset()...
Generated JIT code for Compilation:
Code at [0x115f74980, 0x115f749a0):
<0> 0x115f74980: pacibsp
<4> 0x115f74984: stp fp, lr, [sp, #-16]!
<8> 0x115f74988: mov fp, sp
<12> 0x115f7498c: ubfx x0, x0, #0, #32; emitSave
<16> 0x115f74990: add x0, x2, x0
<20> 0x115f74994: sturb w1, [x0, #1]
<24> 0x115f74998: ldp fp, lr, [sp], #16
<28> 0x115f7499c: retab
After:
O2: testWasmAddressWithOffset()...
Generated JIT code for Compilation:
Code at [0x121108980, 0x1211089a0):
<0> 0x121108980: pacibsp
<4> 0x121108984: stp fp, lr, [sp, #-16]!
<8> 0x121108988: mov fp, sp
<12> 0x12110898c: add x0, x2, w0, uxtw; emitSave
<16> 0x121108990: sturb w1, [x0, #1]
<20> 0x121108994: ldp fp, lr, [sp], #16
<24> 0x121108998: retab
* Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::addZeroExtend64):
(JSC::MacroAssemblerARM64::addSignExtend64):
* Source/JavaScriptCore/b3/B3LowerToAir.cpp:
* Source/JavaScriptCore/b3/air/AirInstInlines.h:
(JSC::B3::Air::isAddZeroExtend64Valid):
(JSC::B3::Air::isAddSignExtend64Valid):
* Source/JavaScriptCore/b3/air/AirOpcode.opcodes:
Canonical link: https://commits.webkit.org/258259@main
More information about the webkit-changes
mailing list