summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit.asm.js11
-rw-r--r--test/unit.fromasm15
-rw-r--r--test/unit.fromasm.clamp15
-rw-r--r--test/unit.fromasm.clamp.no-opts24
-rw-r--r--test/unit.fromasm.imprecise15
-rw-r--r--test/unit.fromasm.imprecise.no-opts24
-rw-r--r--test/unit.fromasm.no-opts24
7 files changed, 128 insertions, 0 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js
index 11de89c60..9d5f40aea 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -680,8 +680,19 @@ function asm(global, env, buffer) {
return +(+Math_sqrt(x) + +Math_fround(Math_sqrt(Math_fround(x))));
}
+ function f2u(x) {
+ x = +x;
+ return (~~x>>>0) | 0;
+ }
+ function f2s(x) {
+ x = +x;
+ return (~~x) | 0;
+ }
+
function keepAlive() {
sqrts(3.14159);
+ f2u(100.0);
+ f2s(100.0);
}
function v() {
diff --git a/test/unit.fromasm b/test/unit.fromasm
index fd0fb27a0..45dc81937 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -1155,12 +1155,27 @@
)
)
)
+ (func $f2u (param $0 f64) (result i32)
+ (call $f64-to-int
+ (get_local $0)
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
)
(func $vi (param $0 i32)
(nop)
diff --git a/test/unit.fromasm.clamp b/test/unit.fromasm.clamp
index ffe26a3a2..469c4932b 100644
--- a/test/unit.fromasm.clamp
+++ b/test/unit.fromasm.clamp
@@ -1179,12 +1179,27 @@
)
)
)
+ (func $f2u (param $0 f64) (result i32)
+ (call $f64-to-int
+ (get_local $0)
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
)
(func $vi (param $0 i32)
(nop)
diff --git a/test/unit.fromasm.clamp.no-opts b/test/unit.fromasm.clamp.no-opts
index 9d9258bf2..d8fab1d25 100644
--- a/test/unit.fromasm.clamp.no-opts
+++ b/test/unit.fromasm.clamp.no-opts
@@ -1911,12 +1911,36 @@
)
)
)
+ (func $f2u (param $x f64) (result i32)
+ (return
+ (call $f64-to-int
+ (get_local $x)
+ )
+ )
+ )
+ (func $f2s (param $x f64) (result i32)
+ (return
+ (call $f64-to-int
+ (get_local $x)
+ )
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2s
+ (f64.const 100)
+ )
+ )
)
(func $v
(nop)
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index e94c07f7f..18eba6cee 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -1123,12 +1123,27 @@
)
)
)
+ (func $f2u (param $0 f64) (result i32)
+ (i32.trunc_s/f64
+ (get_local $0)
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
)
(func $vi (param $0 i32)
(nop)
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index f1625311d..109afbf26 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -1871,12 +1871,36 @@
)
)
)
+ (func $f2u (param $x f64) (result i32)
+ (return
+ (i32.trunc_s/f64
+ (get_local $x)
+ )
+ )
+ )
+ (func $f2s (param $x f64) (result i32)
+ (return
+ (i32.trunc_s/f64
+ (get_local $x)
+ )
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2s
+ (f64.const 100)
+ )
+ )
)
(func $v
(nop)
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index 2bffda308..3b80ebe1b 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -1887,12 +1887,36 @@
)
)
)
+ (func $f2u (param $x f64) (result i32)
+ (return
+ (call $f64-to-int
+ (get_local $x)
+ )
+ )
+ )
+ (func $f2s (param $x f64) (result i32)
+ (return
+ (call $f64-to-int
+ (get_local $x)
+ )
+ )
+ )
(func $keepAlive
(drop
(call $sqrts
(f64.const 3.14159)
)
)
+ (drop
+ (call $f2u
+ (f64.const 100)
+ )
+ )
+ (drop
+ (call $f2s
+ (f64.const 100)
+ )
+ )
)
(func $v
(nop)