summaryrefslogtreecommitdiff
path: root/test/wasm-only.fromasm
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm-only.fromasm')
-rw-r--r--test/wasm-only.fromasm102
1 files changed, 88 insertions, 14 deletions
diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm
index 2ac96b8ae..6eb8bb5fe 100644
--- a/test/wasm-only.fromasm
+++ b/test/wasm-only.fromasm
@@ -266,6 +266,32 @@
)
)
)
+ (func $f32-to-int64 (param $0 f32) (result i64)
+ (if (result i64)
+ (f32.ne
+ (get_local $0)
+ (get_local $0)
+ )
+ (i64.const -9223372036854775808)
+ (if (result i64)
+ (f32.ge
+ (get_local $0)
+ (f32.const 9223372036854775808)
+ )
+ (i64.const -9223372036854775808)
+ (if (result i64)
+ (f32.le
+ (get_local $0)
+ (f32.const -9223372036854775808)
+ )
+ (i64.const -9223372036854775808)
+ (i64.trunc_s/f32
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
(func $f64-to-int64 (param $0 f64) (result i64)
(if (result i64)
(f64.ne
@@ -292,6 +318,58 @@
)
)
)
+ (func $f32-to-uint64 (param $0 f32) (result i64)
+ (if (result i64)
+ (f32.ne
+ (get_local $0)
+ (get_local $0)
+ )
+ (i64.const 0)
+ (if (result i64)
+ (f32.ge
+ (get_local $0)
+ (f32.const 18446744073709551615)
+ )
+ (i64.const 0)
+ (if (result i64)
+ (f32.le
+ (get_local $0)
+ (f32.const -1)
+ )
+ (i64.const 0)
+ (i64.trunc_u/f32
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
+ (func $f64-to-uint64 (param $0 f64) (result i64)
+ (if (result i64)
+ (f64.ne
+ (get_local $0)
+ (get_local $0)
+ )
+ (i64.const 0)
+ (if (result i64)
+ (f64.ge
+ (get_local $0)
+ (f64.const 18446744073709551615)
+ )
+ (i64.const 0)
+ (if (result i64)
+ (f64.le
+ (get_local $0)
+ (f64.const -1)
+ )
+ (i64.const 0)
+ (i64.trunc_u/f64
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
(func $test64
(local $0 i64)
(local $1 f32)
@@ -376,15 +454,13 @@
(get_local $0)
)
(drop
- (call $f64-to-int64
- (f64.promote/f32
- (tee_local $1
- (f32.convert_u/i64
- (tee_local $0
- (i64.extend_u/i32
- (i32.wrap/i64
- (get_local $0)
- )
+ (call $f32-to-int64
+ (tee_local $1
+ (f32.convert_u/i64
+ (tee_local $0
+ (i64.extend_u/i32
+ (i32.wrap/i64
+ (get_local $0)
)
)
)
@@ -402,14 +478,12 @@
)
)
(drop
- (call $f64-to-int64
- (f64.promote/f32
- (get_local $1)
- )
+ (call $f32-to-uint64
+ (get_local $1)
)
)
(drop
- (call $f64-to-int64
+ (call $f64-to-uint64
(get_local $2)
)
)