Skip to content
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

Cranelift: ishl.i8 with i128 shift amount panics #2672

Closed
bjorn3 opened this issue Feb 21, 2021 · 0 comments · Fixed by #2682
Closed

Cranelift: ishl.i8 with i128 shift amount panics #2672

bjorn3 opened this issue Feb 21, 2021 · 0 comments · Fixed by #2682
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator

Comments

@bjorn3
Copy link
Contributor

bjorn3 commented Feb 21, 2021

Steps to Reproduce

Try to compile an ishl instruction with an i8 lhs and i128 rhs using the x64 backend.

Expected Results

It compiles.

Actual Results

Panics with thread 'rustc' panicked at 'Multi-register value not expected', /home/bjorn/.cargo/git/checkouts/wasmtime-41807828cb3a7a7e/c07ec4c/cranelift/codegen/src/isa/x64/lower.rs:128:10

Versions and Environment

Cranelift version or commit: c07ec4c

Operating system: N/A

Architecture: x86_64

@bjorn3 bjorn3 added bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator labels Feb 21, 2021
cfallin added a commit to cfallin/wasmtime that referenced this issue Feb 23, 2021
This fixes bytecodealliance#2672 and bytecodealliance#2679, and also fixes an incorrect instruction
emission (`test` with small immediate) that we had missed earlier.

The shift-related fixes have to do with (i) shifts by 0 bits, as a
special case that must be handled; and (ii) shifts by a 128-bit amount,
which we can handle by just dropping the upper half (we only use 3--7
bits of shift amount).

This adjusts the lowerings appropriately, and also adds run-tests to
ensure that the lowerings actually execute correctly (previously we only
had compile-tests with golden lowerings; I'd like to correct this for
more ops eventually, adding run-tests beyond what the Wasm spec and
frontend covers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant