-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smaller encoding for v128 scalar constants #1476
Comments
Another trick would be to declare a v128 local that will be implicitly initialized to zero, then use a |
Yeah, I was thinking of experimenting with a local, but from looking at the code I'm not sure v8 / spidermonkey etc will realize that it's constant. Turning the consts into memory loads would probably be pretty bad. I got measurable speedups by switching my |
For Ion in SpiderMonkey, we'll generate equivalent IR for |
I think we should be able to generate better code for |
https://bugs.webkit.org/show_bug.cgi?id=257051 Reviewed by Yusuke Suzuki. According to WebAssembly/design#1476 at least one person wants to encode vector 0 as Splat i32.const 0 since the former's encoding is 18 bytes whereas the latter is 5 bytes. As such, we should emit Splat i32.const 0/-1 as the optimal code in BBQJIT. * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJIT::addSIMDSplat): Canonical link: https://commits.webkit.org/264280@main
From what I can see, the only way to create a v128 zero vector (for example to do unrolled memsets) is a full v128_const, weighing in at around 18 bytes (painful since my JIT is limited to 4kb). i64_const + splat would be one smaller encoding, but it doesn't look like v8 optimizes that, and it's probably unreasonable to expect it to get optimized. It might be good to try and add a v128_const_zero or v128_const_splat equivalent in any future iteration of SIMD, I can imagine this being even worse when wider vector types are added. Maybe this only needs to happen in the binary format, but it wouldn't be backwards compatible to change the existing opcode.
The text was updated successfully, but these errors were encountered: