bytecodealliance / bytecodealliance/wasmtime

Cranelift: use `shld`/`shrd` in 128-bit shift lowerings

Open
#3,477 3 comments 0 reactions 0 assignees View on GitHub
cranelift cranelift:area:x64 enhancement
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

Right now we manually do two `shl`s/`shr`s and then compute the carry bits and `or` them into the high half.

We could just use `shld` and `shrd`, which handle the carry bits for us.

* https://www.felixcloutier.com/x86/shld
* https://www.felixcloutier.com/x86/shrd

This is what LLVM does, fwiw: https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=34e3a56cdaa9db7b1d5f4c429ad3db4f

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.