Stream: git-wasmtime

Topic: wasmtime / issue #5714 Cranelift: `fcvt_to_sint_sat.i8` w...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:06):

afonso360 opened issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok

view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:06):

afonso360 labeled issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok

view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:06):

afonso360 labeled issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok

view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:06):

afonso360 labeled issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok

view this post on Zulip Wasmtime GitHub notifications bot (Feb 05 2023 at 18:09):

afonso360 edited issue #5714:

:wave: Hey,

Fuzzgen found this, Its hard to minimize because changing an unrelated instruction spontaneously causes the test to start passing again.

.clif Test Case

test interpret
test run
target riscv64gc

function %a(i32 sext, f64, f32, i64 uext) -> f32, i8, i8 system_v {
block0(v0: i32, v1: f64, v2: f32, v3: i64):
    v12 -> v1
    v14 -> v2
    v16 -> v2
    v4 = iconst.i16 0x4242
    v5 = iconst.i64 0x0042_4242_4242_4242
    jump block1

block1:
    v13 = fcvt_to_sint_sat.i8 v12
    v15 -> v13
    brif v13, block2, block1

block2:
    return v14, v15, v15
}

; run: %a(1111441986, -0x1.ffa8b425b4242p128, 0x0.00859ep-126, 0) == [0x0.00859ep-126, -128, -128]

<details>
<summary>Edit: This testcase segfaults instead of going into an infinite loop</summary>

test interpret
test run
target riscv64gc

function %a(i8 sext, i128 sext, f32, f64, f64, f64, f64, f64, f64, i32 uext, i16 uext, i64 sext) -> f64, f32, i64 sext, i64 sext, i32, f32, f32, f32, f32 system_v {
block0(v0: i8, v1: i128, v2: f32, v3: f64, v4: f64, v5: f64, v6: f64, v7: f64, v8: f64, v9: i32, v10: i16, v11: i64):
    v24 -> v4
    v25 -> v11
    v16 = iconst.i8 0
    v17 = iconst.i16 0
    v18 = iconst.i32 0
    v19 = iconst.i64 0
    v20 = uextend.i128 v19  ; v19 = 0
    v21 = fcvt_to_sint_sat.i16 v5
    v23 -> v21
    v22 = sshr v9, v9
    v26 -> v22
    brif v22, block1(v2, v2), block1(v2, v2)

block1(v12: f32, v13: f32):
    brif.i16 v23, block2(v13, v13), block2(v13, v13)

block2(v14: f32, v15: f32):
    return v24, v15, v25, v25, v26, v15, v15, v15, v15
}

; run: %a(47, 19850, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]
; run: %a(0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0) == [0.0, 0.0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0]

</details>

Steps to Reproduce

Expected Results

The test to pass

Actual Results

The test case goes into an infinite loop due to a wrong result from fcvt_to_sint_sat

Versions and Environment

Cranelift version or commit: main
Operating system: Linux
Architecture: riscv64

cc: @yuyang-ok


Last updated: Nov 22 2024 at 16:03 UTC