summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/unit.asm.js12
-rw-r--r--test/unit.fromasm22
-rw-r--r--test/unit.fromasm.imprecise22
-rw-r--r--test/unit.fromasm.imprecise.no-opts24
-rw-r--r--test/unit.fromasm.no-opts24
5 files changed, 103 insertions, 1 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js
index a865350f6..11de89c60 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -9,6 +9,7 @@ function asm(global, env, buffer) {
var Math_ceil = global.Math.ceil;
var Math_max = global.Math.max;
var Math_min = global.Math.min;
+ var Math_sqrt = global.Math.sqrt;
var tempDoublePtr = env.tempDoublePtr | 0;
var n = env.gb | 0;
var STACKTOP = env.STACKTOP | 0;
@@ -674,6 +675,15 @@ function asm(global, env, buffer) {
return Math_fround(y);
}
+ function sqrts(x) {
+ x = +x;
+ return +(+Math_sqrt(x) + +Math_fround(Math_sqrt(Math_fround(x))));
+ }
+
+ function keepAlive() {
+ sqrts(3.14159);
+ }
+
function v() {
}
function vi(x) {
@@ -685,6 +695,6 @@ function asm(global, env, buffer) {
var FUNCTION_TABLE_c = [ z, cneg, z, z, z, z, z, z ];
var FUNCTION_TABLE_vi = [ vi, vi, vi, vi, vi, vi, vi, vi ];
- return { big_negative: big_negative, pick: forgetMe, pick: exportMe, doubleCompares: doubleCompares, intOps: intOps, conversions: conversions, switcher: switcher, frem: frem, big_uint_div_u: big_uint_div_u, fr: fr, negZero: negZero, neg: neg, smallCompare: smallCompare, cneg_nosemicolon: cneg_nosemicolon, forLoop: forLoop, ceiling_32_64: ceiling_32_64, aborts: aborts, continues: continues, bitcasts: bitcasts, recursiveBlockMerging: recursiveBlockMerging, lb: lb, zeroInit: zeroInit, phi: phi, smallIf: smallIf, dropCall: dropCall, useSetGlobal: useSetGlobal, usesSetGlobal2: usesSetGlobal2, breakThroughMany: breakThroughMany, ifChainEmpty: ifChainEmpty, heap8NoShift: heap8NoShift, conditionalTypeFun: conditionalTypeFun, loadSigned: loadSigned, globalOpts: globalOpts, dropCallImport: dropCallImport, loophi: loophi, loophi2: loophi2, relooperJumpThreading: relooperJumpThreading, relooperJumpThreading__ZN4game14preloadweaponsEv: relooperJumpThreading__ZN4game14preloadweaponsEv, __Z12multi_varargiz: __Z12multi_varargiz, jumpThreadDrop: jumpThreadDrop, dropIgnoredImportInIf: dropIgnoredImportInIf, dropIgnoredImportsInIf: dropIgnoredImportsInIf, relooperJumpThreading_irreducible: relooperJumpThreading_irreducible, store_fround: store_fround, exportedNumber: 42, relocatableAndModules: relocatableAndModules, exported_f32_user: exported_f32_user };
+ return { big_negative: big_negative, pick: forgetMe, pick: exportMe, doubleCompares: doubleCompares, intOps: intOps, conversions: conversions, switcher: switcher, frem: frem, big_uint_div_u: big_uint_div_u, fr: fr, negZero: negZero, neg: neg, smallCompare: smallCompare, cneg_nosemicolon: cneg_nosemicolon, forLoop: forLoop, ceiling_32_64: ceiling_32_64, aborts: aborts, continues: continues, bitcasts: bitcasts, recursiveBlockMerging: recursiveBlockMerging, lb: lb, zeroInit: zeroInit, phi: phi, smallIf: smallIf, dropCall: dropCall, useSetGlobal: useSetGlobal, usesSetGlobal2: usesSetGlobal2, breakThroughMany: breakThroughMany, ifChainEmpty: ifChainEmpty, heap8NoShift: heap8NoShift, conditionalTypeFun: conditionalTypeFun, loadSigned: loadSigned, globalOpts: globalOpts, dropCallImport: dropCallImport, loophi: loophi, loophi2: loophi2, relooperJumpThreading: relooperJumpThreading, relooperJumpThreading__ZN4game14preloadweaponsEv: relooperJumpThreading__ZN4game14preloadweaponsEv, __Z12multi_varargiz: __Z12multi_varargiz, jumpThreadDrop: jumpThreadDrop, dropIgnoredImportInIf: dropIgnoredImportInIf, dropIgnoredImportsInIf: dropIgnoredImportsInIf, relooperJumpThreading_irreducible: relooperJumpThreading_irreducible, store_fround: store_fround, exportedNumber: 42, relocatableAndModules: relocatableAndModules, exported_f32_user: exported_f32_user, keepAlive: keepAlive };
}
diff --git a/test/unit.fromasm b/test/unit.fromasm
index bbce09412..d2f569684 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -72,6 +72,7 @@
(export "exportedNumber" (global $exportedNumber))
(export "relocatableAndModules" (func $relocatableAndModules))
(export "exported_f32_user" (func $legalstub$exported_f32_user))
+ (export "keepAlive" (func $keepAlive))
(func $big_negative
(nop)
)
@@ -1158,6 +1159,27 @@
(func $exported_f32_user (param $0 i32) (param $1 f32) (param $2 f64) (result f32)
(get_local $1)
)
+ (func $sqrts (param $0 f64) (result f64)
+ (f64.add
+ (f64.sqrt
+ (get_local $0)
+ )
+ (f64.promote/f32
+ (f32.sqrt
+ (f32.demote/f64
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
+ (func $keepAlive
+ (drop
+ (call $sqrts
+ (f64.const 3.14159)
+ )
+ )
+ )
(func $vi (param $0 i32)
(nop)
)
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index caa8e4f33..5951d9941 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -69,6 +69,7 @@
(export "exportedNumber" (global $exportedNumber))
(export "relocatableAndModules" (func $relocatableAndModules))
(export "exported_f32_user" (func $legalstub$exported_f32_user))
+ (export "keepAlive" (func $keepAlive))
(func $big_negative
(nop)
)
@@ -1126,6 +1127,27 @@
(func $exported_f32_user (param $0 i32) (param $1 f32) (param $2 f64) (result f32)
(get_local $1)
)
+ (func $sqrts (param $0 f64) (result f64)
+ (f64.add
+ (f64.sqrt
+ (get_local $0)
+ )
+ (f64.promote/f32
+ (f32.sqrt
+ (f32.demote/f64
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
+ (func $keepAlive
+ (drop
+ (call $sqrts
+ (f64.const 3.14159)
+ )
+ )
+ )
(func $vi (param $0 i32)
(nop)
)
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index eafbb32f7..c872d9053 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -77,6 +77,7 @@
(export "exportedNumber" (global $exportedNumber))
(export "relocatableAndModules" (func $relocatableAndModules))
(export "exported_f32_user" (func $legalstub$exported_f32_user))
+ (export "keepAlive" (func $keepAlive))
(func $big_negative
(local $temp f64)
(set_local $temp
@@ -1848,6 +1849,29 @@
(get_local $y)
)
)
+ (func $sqrts (param $x f64) (result f64)
+ (return
+ (f64.add
+ (f64.sqrt
+ (get_local $x)
+ )
+ (f64.promote/f32
+ (f32.sqrt
+ (f32.demote/f64
+ (get_local $x)
+ )
+ )
+ )
+ )
+ )
+ )
+ (func $keepAlive
+ (drop
+ (call $sqrts
+ (f64.const 3.14159)
+ )
+ )
+ )
(func $v
(nop)
)
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index d18dfd77e..d912a09cb 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -79,6 +79,7 @@
(export "exportedNumber" (global $exportedNumber))
(export "relocatableAndModules" (func $relocatableAndModules))
(export "exported_f32_user" (func $legalstub$exported_f32_user))
+ (export "keepAlive" (func $keepAlive))
(func $big_negative
(local $temp f64)
(set_local $temp
@@ -1864,6 +1865,29 @@
(get_local $y)
)
)
+ (func $sqrts (param $x f64) (result f64)
+ (return
+ (f64.add
+ (f64.sqrt
+ (get_local $x)
+ )
+ (f64.promote/f32
+ (f32.sqrt
+ (f32.demote/f64
+ (get_local $x)
+ )
+ )
+ )
+ )
+ )
+ )
+ (func $keepAlive
+ (drop
+ (call $sqrts
+ (f64.const 3.14159)
+ )
+ )
+ )
(func $v
(nop)
)