summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit.asm.js6
-rw-r--r--test/unit.fromasm64
-rw-r--r--test/unit.fromasm.imprecise64
-rw-r--r--test/unit.fromasm.imprecise.no-opts66
-rw-r--r--test/unit.fromasm.no-opts66
5 files changed, 210 insertions, 56 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js
index 25aed0834..e76ae1ef9 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -324,6 +324,12 @@ function asm(global, env, buffer) {
return HEAP8[x | 0] | 0;
}
+ function conditionalTypeFun() {
+ var x = 0, y = +0;
+ x = 1 ? abort(5) | 0 : 2;
+ y = 3 ? +abort(7) : 4.5;
+ }
+
function z() {
}
function w() {
diff --git a/test/unit.fromasm b/test/unit.fromasm
index 98202a4ec..a3fbf0add 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -7,13 +7,13 @@
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
- (type $FUNCSIG$vd (func (param f64)))
+ (type $FUNCSIG$dd (func (param f64) (result f64)))
(import $t global "global" "NaN" f64)
(import $u global "global" "Infinity" f64)
(import $tempDoublePtr global "env" "tempDoublePtr" i32)
(import $n global "env" "gb" i32)
(import $setTempRet0 "env" "setTempRet0" (param i32) (result i32))
- (import $abort "env" "abort" (param f64))
+ (import $abort "env" "abort" (param f64) (result f64))
(import $print "env" "print" (param i32))
(import $h "env" "h" (param i32))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
@@ -319,23 +319,33 @@
(nop)
)
(func $aborts
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.convert_s/i32
- (i32.const 55)
+ (drop
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 55)
+ )
)
)
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.const 12.34)
+ (drop
+ (call_import $abort
+ (f64.const 12.34)
+ )
)
- (call_import $abort
- (f64.promote/f32
- (f32.const 56.779998779296875)
+ (drop
+ (call_import $abort
+ (f64.promote/f32
+ (f32.const 56.779998779296875)
+ )
)
)
)
@@ -580,4 +590,30 @@
(get_local $0)
)
)
+ (func $conditionalTypeFun
+ (drop
+ (if
+ (i32.const 1)
+ (i32.trunc_s/f64
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 5)
+ )
+ )
+ )
+ (i32.const 2)
+ )
+ )
+ (drop
+ (if
+ (i32.const 3)
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 7)
+ )
+ )
+ (f64.const 4.5)
+ )
+ )
+ )
)
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index 493ebb67e..46de1092f 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -4,13 +4,13 @@
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
- (type $FUNCSIG$vd (func (param f64)))
+ (type $FUNCSIG$dd (func (param f64) (result f64)))
(import $t global "global" "NaN" f64)
(import $u global "global" "Infinity" f64)
(import $tempDoublePtr global "env" "tempDoublePtr" i32)
(import $n global "env" "gb" i32)
(import $setTempRet0 "env" "setTempRet0" (param i32) (result i32))
- (import $abort "env" "abort" (param f64))
+ (import $abort "env" "abort" (param f64) (result f64))
(import $print "env" "print" (param i32))
(import $h "env" "h" (param i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
@@ -300,23 +300,33 @@
(nop)
)
(func $aborts
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.convert_s/i32
- (i32.const 55)
+ (drop
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 55)
+ )
)
)
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.const 12.34)
+ (drop
+ (call_import $abort
+ (f64.const 12.34)
+ )
)
- (call_import $abort
- (f64.promote/f32
- (f32.const 56.779998779296875)
+ (drop
+ (call_import $abort
+ (f64.promote/f32
+ (f32.const 56.779998779296875)
+ )
)
)
)
@@ -561,4 +571,30 @@
(get_local $0)
)
)
+ (func $conditionalTypeFun
+ (drop
+ (if
+ (i32.const 1)
+ (i32.trunc_s/f64
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 5)
+ )
+ )
+ )
+ (i32.const 2)
+ )
+ )
+ (drop
+ (if
+ (i32.const 3)
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 7)
+ )
+ )
+ (f64.const 4.5)
+ )
+ )
+ )
)
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 89a448a82..3f82776e5 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -4,13 +4,13 @@
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
- (type $FUNCSIG$vd (func (param f64)))
+ (type $FUNCSIG$dd (func (param f64) (result f64)))
(import $t global "global" "NaN" f64)
(import $u global "global" "Infinity" f64)
(import $tempDoublePtr global "env" "tempDoublePtr" i32)
(import $n global "env" "gb" i32)
(import $setTempRet0 "env" "setTempRet0" (param i32) (result i32))
- (import $abort "env" "abort" (param f64))
+ (import $abort "env" "abort" (param f64) (result f64))
(import $print "env" "print" (param i32))
(import $h "env" "h" (param i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
@@ -543,23 +543,33 @@
)
)
(func $aborts
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.convert_s/i32
- (i32.const 55)
+ (drop
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 55)
+ )
)
)
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.const 12.34)
+ (drop
+ (call_import $abort
+ (f64.const 12.34)
+ )
)
- (call_import $abort
- (f64.promote/f32
- (f32.const 56.779998779296875)
+ (drop
+ (call_import $abort
+ (f64.promote/f32
+ (f32.const 56.779998779296875)
+ )
)
)
)
@@ -963,6 +973,34 @@
)
)
)
+ (func $conditionalTypeFun
+ (local $x i32)
+ (local $y f64)
+ (set_local $x
+ (if
+ (i32.const 1)
+ (i32.trunc_s/f64
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 5)
+ )
+ )
+ )
+ (i32.const 2)
+ )
+ )
+ (set_local $y
+ (if
+ (i32.const 3)
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 7)
+ )
+ )
+ (f64.const 4.5)
+ )
+ )
+ )
(func $z
(nop)
)
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index f1253c849..c55a309e6 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -6,13 +6,13 @@
(type $FUNCSIG$vf (func (param f32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
- (type $FUNCSIG$vd (func (param f64)))
+ (type $FUNCSIG$dd (func (param f64) (result f64)))
(import $t global "global" "NaN" f64)
(import $u global "global" "Infinity" f64)
(import $tempDoublePtr global "env" "tempDoublePtr" i32)
(import $n global "env" "gb" i32)
(import $setTempRet0 "env" "setTempRet0" (param i32) (result i32))
- (import $abort "env" "abort" (param f64))
+ (import $abort "env" "abort" (param f64) (result f64))
(import $print "env" "print" (param i32))
(import $h "env" "h" (param i32))
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
@@ -549,23 +549,33 @@
)
)
(func $aborts
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.convert_s/i32
- (i32.const 55)
+ (drop
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 55)
+ )
)
)
- (call_import $abort
- (f64.const 0)
+ (drop
+ (call_import $abort
+ (f64.const 0)
+ )
)
- (call_import $abort
- (f64.const 12.34)
+ (drop
+ (call_import $abort
+ (f64.const 12.34)
+ )
)
- (call_import $abort
- (f64.promote/f32
- (f32.const 56.779998779296875)
+ (drop
+ (call_import $abort
+ (f64.promote/f32
+ (f32.const 56.779998779296875)
+ )
)
)
)
@@ -969,6 +979,34 @@
)
)
)
+ (func $conditionalTypeFun
+ (local $x i32)
+ (local $y f64)
+ (set_local $x
+ (if
+ (i32.const 1)
+ (i32.trunc_s/f64
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 5)
+ )
+ )
+ )
+ (i32.const 2)
+ )
+ )
+ (set_local $y
+ (if
+ (i32.const 3)
+ (call_import $abort
+ (f64.convert_s/i32
+ (i32.const 7)
+ )
+ )
+ (f64.const 4.5)
+ )
+ )
+ )
(func $z
(nop)
)