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: fcvt_to_{u,s}int{,_sat} not implemented for {i8,i16} types on x64 #4897

Open
afonso360 opened this issue Sep 12, 2022 · 2 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator

Comments

@afonso360
Copy link
Contributor

afonso360 commented Sep 12, 2022

👋 Hey,

This came up when trying to fuzz #4884

.clif Test Case

So this is a bunch of separate cases, I can split it into multiple issues if you'd like:

fcvt_to_uint
test interpret
test run
target x86_64

function %a(f32) -> i8 {
block0(v0: f32):
    v1 = fcvt_to_uint.i8 v0
    return v1
}
; run: %a(0.0) == 0

function %b(f32) -> i16 {
block0(v0: f32):
    v1 = fcvt_to_uint.i16 v0
    return v1
}
; run: %b(0.0) == 0

function %c(f64) -> i8 {
block0(v0: f64):
    v1 = fcvt_to_uint.i8 v0
    return v1
}
; run: %c(0.0) == 0

function %d(f64) -> i16 {
block0(v0: f64):
    v1 = fcvt_to_uint.i16 v0
    return v1
}
; run: %d(0.0) == 0
fcvt_to_sint
test interpret
test run
target x86_64

function %signed_a(f32) -> i8 {
block0(v0: f32):
    v1 = fcvt_to_sint.i8 v0
    return v1
}
; run: %signed_a(0.0) == 0

function %signed_b(f32) -> i16 {
block0(v0: f32):
    v1 = fcvt_to_sint.i16 v0
    return v1
}
; run: %signed_b(0.0) == 0

function %signed_c(f64) -> i8 {
block0(v0: f64):
    v1 = fcvt_to_sint.i8 v0
    return v1
}
; run: %signed_c(0.0) == 0

function %signed_d(f64) -> i16 {
block0(v0: f64):
    v1 = fcvt_to_sint.i16 v0
    return v1
}
; run: %signed_d(0.0) == 0
fcvt_to_uint_sat
test interpret
test run
target x86_64

function %a(f32) -> i8 {
block0(v0: f32):
    v1 = fcvt_to_uint_sat.i8 v0
    return v1
}
; run: %a(0.0) == 0

function %b(f32) -> i16 {
block0(v0: f32):
    v1 = fcvt_to_uint_sat.i16 v0
    return v1
}
; run: %b(0.0) == 0

function %c(f64) -> i8 {
block0(v0: f64):
    v1 = fcvt_to_uint_sat.i8 v0
    return v1
}
; run: %c(0.0) == 0

function %d(f64) -> i16 {
block0(v0: f64):
    v1 = fcvt_to_uint_sat.i16 v0
    return v1
}
; run: %d(0.0) == 0

fcvt_to_sint_sat
test interpret
test run
target x86_64

function %signed_a(f32) -> i8 {
block0(v0: f32):
    v1 = fcvt_to_sint_sat.i8 v0
    return v1
}
; run: %signed_a(0.0) == 0

function %signed_b(f32) -> i16 {
block0(v0: f32):
    v1 = fcvt_to_sint_sat.i16 v0
    return v1
}
; run: %signed_b(0.0) == 0

function %signed_c(f64) -> i8 {
block0(v0: f64):
    v1 = fcvt_to_sint_sat.i8 v0
    return v1
}
; run: %signed_c(0.0) == 0

function %signed_d(f64) -> i16 {
block0(v0: f64):
    v1 = fcvt_to_sint_sat.i16 v0
    return v1
}
; run: %signed_d(0.0) == 0

Steps to Reproduce

  • clif-util ./the-above.clif

Expected Results

The above tests to pass.

Actual Results

thread 'worker #0' panicked at 'assertion failed: dst_size.is_one_of(&[OperandSize::Size32, OperandSize::Size64])', cranelift\codegen\src\isa\x64\inst\mod.rs:331:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 ERROR cranelift_filetests::concurrent > FAIL: panicked in worker #0: assertion failed: dst_size.is_one_of(&[OperandSize::Size32, OperandSize::Size64])
FAIL .\lmao.clif: panicked in worker #0: assertion failed: dst_size.is_one_of(&[OperandSize::Size32, OperandSize::Size64])
1 tests
Error: 1 failure

This fails in the first function but all of the functions in all test cases crash with a similar error.

Versions and Environment

Cranelift version or commit: main
Operating system: Windows
Architecture: x64

@afonso360 afonso360 added bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator labels Sep 12, 2022
@afonso360 afonso360 changed the title Cranelift: fcvt_to_uint not implemented for {i8,i16} types on x64 Cranelift: fcvt_to_{u,s}int not implemented for {i8,i16} types on x64 Sep 12, 2022
@bjorn3
Copy link
Contributor

bjorn3 commented Sep 12, 2022

@afonso360 afonso360 changed the title Cranelift: fcvt_to_{u,s}int not implemented for {i8,i16} types on x64 Cranelift: fcvt_to_{u,s}int{,_sat} not implemented for {i8,i16} types on x64 Sep 12, 2022
@EdorianDark
Copy link

I think this is releated to #1045

@akirilov-arm akirilov-arm added the cranelift:area:x64 Issues related to x64 codegen label Sep 26, 2022
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:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

No branches or pull requests

4 participants