summaryrefslogtreecommitdiff
path: root/test/wasm2asm/float-ops.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2asm/float-ops.wast')
-rw-r--r--test/wasm2asm/float-ops.wast37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/wasm2asm/float-ops.wast b/test/wasm2asm/float-ops.wast
index de26c9931..f724149cb 100644
--- a/test/wasm2asm/float-ops.wast
+++ b/test/wasm2asm/float-ops.wast
@@ -107,4 +107,41 @@
(f64.copysign (get_local $0) (get_local $1)))
(func $copysign32 (param $0 f32) (param $1 f32) (result f32)
(f32.copysign (get_local $0) (get_local $1)))
+
+ ;; float<->int
+ (func (export "i32_to_f32") (param $0 i32) (result f32)
+ (f32.convert_s/i32 (get_local $0)))
+ (func (export "i32_to_f64") (param $0 i32) (result f64)
+ (f64.convert_s/i32 (get_local $0)))
+ (func (export "u32_to_f32") (param $0 i32) (result f32)
+ (f32.convert_u/i32 (get_local $0)))
+ (func (export "u32_to_f64") (param $0 i32) (result f64)
+ (f64.convert_u/i32 (get_local $0)))
+
+ (func (export "f32_to_i32") (param $0 f32) (result i32)
+ (i32.trunc_s/f32 (get_local $0)))
+ (func (export "f64_to_i32") (param $0 f64) (result i32)
+ (i32.trunc_s/f64 (get_local $0)))
+ (func (export "f32_to_u32") (param $0 f32) (result i32)
+ (i32.trunc_u/f32 (get_local $0)))
+ (func (export "f64_to_u32") (param $0 f64) (result i32)
+ (i32.trunc_u/f64 (get_local $0)))
+
+ (func (export "i64_to_f32") (param $0 i64) (result f32)
+ (f32.convert_s/i64 (get_local $0)))
+ (func (export "i64_to_f64") (param $0 i64) (result f64)
+ (f64.convert_s/i64 (get_local $0)))
+ (func (export "u64_to_f32") (param $0 i64) (result f32)
+ (f32.convert_u/i64 (get_local $0)))
+ (func (export "u64_to_f64") (param $0 i64) (result f64)
+ (f64.convert_u/i64 (get_local $0)))
+
+ (func (export "f32_to_i64") (param $0 f32) (result i32)
+ (i64.eq (i64.trunc_s/f32 (get_local $0)) (i64.const 0)))
+ (func (export "f64_to_i64") (param $0 f64) (result i32)
+ (i64.eq (i64.trunc_s/f64 (get_local $0)) (i64.const 0)))
+ (func (export "f32_to_u64") (param $0 f32) (result i32)
+ (i64.eq (i64.trunc_u/f32 (get_local $0)) (i64.const 0)))
+ (func (export "f64_to_u64") (param $0 f64) (result i32)
+ (i64.eq (i64.trunc_u/f64 (get_local $0)) (i64.const 0)))
)