You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 128-bit widening multiplication was previously gated by simply
checking the target pointer width. This works as a simple heuristic, but
a better heuristic can be used:
1. Most 64-bit architectures except SPARC64 and Wasm64 support the
128-bit widening multiplication, so it shouldn't be used on those two
architectures.
2. The target pointer width doesn't always indicate that we are dealing
with a 64-bit architecture, as there are ABIs that reduce the pointer
width, especially on AArch64 and x86-64.
3. WebAssembly (regardless of pointer width) supports 64-bit to 128-bit
widening multiplication with the `wide-arithmetic` proposal.
The `wide-arithmetic` proposal is available since the LLVM 20 update and
works perfectly for this use case as can be seen here:
https://rust.godbolt.org/z/9jY7fxqxK
Using `wasmtime explore`, we can see it compiles down to the ideal
instructions on x86-64:
```nasm
mulx rax, rdx, r10
xor rax, rdx
```
Based on the same change in
[`foldhash`](orlp/foldhash#17).
0 commit comments