bytecodealliance / bytecodealliance/wasmtime
Cranelift: x64 backend is missing some lowerings for snarrow and unarrow
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
### `.clif` Test Case
```
function %f3(i64x2, i64x2) -> i32x4 {
block0(v0: i64x2, v1: i64x2):
v2 = snarrow v0, v1
return v2
}
function %f3(i64x2, i64x2) -> i32x4 {
block0(v0: i64x2, v1: i64x2):
v2 = unarrow v0, v1
return v2
}
```
### Steps to Reproduce
Compile the examples with `clif-util compile --target=x86_64`.
### Expected Results
The examples should generate code.
### Actual Results
There's a panic in the x64 code generator, as these case for `i64x2` input is not implemented for `snarrow` and `unarrow`. The following program will compile successfully, as there's a special case for the combination of `snarrow` and `fcvt_to_sint_sat`:
```
function %f3(f64x2) -> i32x4 {
block0(v0: f64x2):
v1 = fcvt_to_sint_sat.i64x2 v0
v2 = vconst.i64x2 0x00
v3 = snarrow v1, v2
return v3
}
```
https://github.com/bytecodealliance/wasmtime/blob/ca6d648e37c80cb13e5027cc746ec0d2e4bd64d1/cranelift/codegen/src/isa/x64/lower.isle#L3275-L3299
### Versions and Environment
Cranelift version or commit: ca6d648e37c80cb13e5027cc746ec0d2e4bd64d1
Operating system: Linux
Architecture: x86_64
Contributor guide
Assessment
This issue has not been assessed yet.