diff --git a/ml-proto/test/conversions.wasm b/ml-proto/test/conversions.wasm index ec3a227b1d..924034d8e2 100644 --- a/ml-proto/test/conversions.wasm +++ b/ml-proto/test/conversions.wasm @@ -147,8 +147,12 @@ (assert_eq (invoke "i32.trunc_u_f64" (f64.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 (assert_eq (invoke "i32.trunc_u_f64" (f64.const 4294967295.0)) (i32.const -1)) (assert_eq (invoke "i32.trunc_u_f64" (f64.const -0.9)) (i32.const 0)) +(assert_eq (invoke "i32.trunc_u_f64" (f64.const 1e8)) (i32.const 100000000)) (assert_trap (invoke "i32.trunc_u_f64" (f64.const 4294967296.0)) "runtime: integer overflow") (assert_trap (invoke "i32.trunc_u_f64" (f64.const -1.0)) "runtime: integer overflow") +(assert_trap (invoke "i32.trunc_u_f64" (f64.const 1e16)) "runtime: integer overflow") +(assert_trap (invoke "i32.trunc_u_f64" (f64.const 1e30)) "runtime: integer overflow") +(assert_trap (invoke "i32.trunc_u_f64" (f64.const 9223372036854775808)) "runtime: integer overflow") (assert_eq (invoke "i64.trunc_s_f32" (f32.const 1.0)) (i64.const 1)) (assert_eq (invoke "i64.trunc_s_f32" (f32.const 1.1)) (i64.const 1)) @@ -192,9 +196,13 @@ (assert_eq (invoke "i64.trunc_u_f64" (f64.const 1.0)) (i64.const 1)) (assert_eq (invoke "i64.trunc_u_f64" (f64.const 1.1)) (i64.const 1)) (assert_eq (invoke "i64.trunc_u_f64" (f64.const 1.5)) (i64.const 1)) -(assert_eq (invoke "i64.trunc_u_f64" (f64.const 4294967296)) (i64.const 4294967296)) +(assert_eq (invoke "i64.trunc_u_f64" (f64.const 4294967295)) (i64.const 0xffffffff)) +(assert_eq (invoke "i64.trunc_u_f64" (f64.const 4294967296)) (i64.const 0x100000000)) (assert_eq (invoke "i64.trunc_u_f64" (f64.const 18446744073709549568.0)) (i64.const -2048)) (assert_eq (invoke "i64.trunc_u_f64" (f64.const -0.9)) (i64.const 0)) +(assert_eq (invoke "i64.trunc_u_f64" (f64.const 1e8)) (i64.const 100000000)) +(assert_eq (invoke "i64.trunc_u_f64" (f64.const 1e16)) (i64.const 10000000000000000)) +(assert_eq (invoke "i64.trunc_u_f64" (f64.const 9223372036854775808)) (i64.const -9223372036854775808)) (assert_trap (invoke "i64.trunc_u_f64" (f64.const 18446744073709551616.0)) "runtime: integer overflow") (assert_trap (invoke "i64.trunc_u_f64" (f64.const -1.0)) "runtime: integer overflow") diff --git a/ml-proto/test/unsigned.wasm b/ml-proto/test/unsigned.wasm deleted file mode 100644 index 492e123588..0000000000 --- a/ml-proto/test/unsigned.wasm +++ /dev/null @@ -1,28 +0,0 @@ -(module - (func $i32_trunc_u (param $x f64) (result i32) - (return (i32.trunc_u/f64 (get_local $x))) - ) - (func $i64_trunc_u (param $x f64) (result i64) - (return (i64.trunc_u/f64 (get_local $x))) - ) - - (export "i32.trunc_u" $i32_trunc_u) - (export "i64.trunc_u" $i64_trunc_u) -) - -(assert_eq (invoke "i32.trunc_u" (f64.const 1e8)) (i32.const 100000000)) -(assert_eq (invoke "i64.trunc_u" (f64.const 1e8)) (i64.const 100000000)) - -(assert_trap (invoke "i32.trunc_u" (f64.const 1e16)) "runtime: integer overflow") -(assert_eq (invoke "i64.trunc_u" (f64.const 1e16)) (i64.const 10000000000000000)) - -(assert_trap (invoke "i32.trunc_u" (f64.const 1e30)) "runtime: integer overflow") -(assert_trap (invoke "i64.trunc_u" (f64.const -1)) "runtime: integer overflow") - -;; max_uint32 -(assert_eq (invoke "i32.trunc_u" (f64.const 4294967295)) (i32.const -1)) -(assert_eq (invoke "i64.trunc_u" (f64.const 4294967295)) (i64.const 4294967295)) - -;; max_int64+1 -(assert_trap (invoke "i32.trunc_u" (f64.const 9223372036854775808)) "runtime: integer overflow") -(assert_eq (invoke "i64.trunc_u" (f64.const 9223372036854775808)) (i64.const -9223372036854775808))