Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6708616ef5efd091b89c1f67d4ed1c7a164c76de
https://github.com/WebKit/WebKit/commit/6708616ef5efd091b89c1f67d4ed1c7a164c76de
Author: Sosuke Suzuki <[email protected]>
Date: 2026-03-18 (Wed, 18 Mar 2026)
Changed paths:
A JSTests/microbenchmarks/wasm-bbq-select-unpredictable.js
A JSTests/wasm/stress/bbq-select-csel.js
M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
Log Message:
-----------
[JSC] Use csel/fcsel for Wasm select in BBQ
https://bugs.webkit.org/show_bug.cgi?id=309996
Reviewed by Justin Michaud.
BBQJIT::addSelect currently emits a conditional branch followed by a move
(cbnz + mov on ARM64). When the condition is data-dependent and hard to
predict, branch mispredictions cost 10-15 cycles each.
This patch emits moveConditionallyTest32 / moveDoubleConditionallyTest32
when both operands are already in registers and the type is not V128,
producing tst + csel (GPR) or tst + fcsel (FPR) on ARM64, and test + cmov
on x86_64 for GPR types. B3 already does the same for OMG via the Select
opcode lowering in B3LowerToAir.
V128 falls back to the branch path since neither ARM64 nor x86_64 has a
128-bit conditional select. Constant operands also fall back since csel
requires register inputs.
TipOfTree Patched
wasm-bbq-select-unpredictable 204.9401+-17.1123 ^ 183.3672+-3.3445
^ definitely 1.1176x faster
Tests: JSTests/microbenchmarks/wasm-bbq-select-unpredictable.js
JSTests/wasm/stress/bbq-select-csel.js
* JSTests/microbenchmarks/wasm-bbq-select-unpredictable.js: Added.
* JSTests/wasm/stress/bbq-select-csel.js: Added.
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJITImpl::BBQJIT::addSelect):
Canonical link: https://commits.webkit.org/309520@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications