summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-07-20 13:33:29 -0700
committerGitHub <noreply@github.com>2017-07-20 13:33:29 -0700
commitda680fdbcb7eaad1c692369c7c826fc02b00c877 (patch)
tree28826407cb8432c53a436381249c70dbaee4a2f6 /test
parent9ff9885b5d5d3415bb83a88967709e0c941be16e (diff)
downloadbinaryen-da680fdbcb7eaad1c692369c7c826fc02b00c877.tar.gz
binaryen-da680fdbcb7eaad1c692369c7c826fc02b00c877.tar.bz2
binaryen-da680fdbcb7eaad1c692369c7c826fc02b00c877.zip
fix f32 frem in asm2wasm #1105 (#1106)
Diffstat (limited to 'test')
-rw-r--r--test/unit.asm.js5
-rw-r--r--test/unit.fromasm14
-rw-r--r--test/unit.fromasm.clamp14
-rw-r--r--test/unit.fromasm.clamp.no-opts20
-rw-r--r--test/unit.fromasm.imprecise14
-rw-r--r--test/unit.fromasm.imprecise.no-opts20
-rw-r--r--test/unit.fromasm.no-opts20
7 files changed, 106 insertions, 1 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js
index 22e180078..065512011 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -137,6 +137,9 @@ function asm(global, env, buffer) {
function frem() {
return +(5.5 % 1.2);
}
+ function frem_float() {
+ return Math_fround(Math_fround(5.5) % Math_fround(1.2));
+ }
function big_uint_div_u() {
var x = 0;
x = (4294967295 / 2)&-1;
@@ -740,6 +743,6 @@ function asm(global, env, buffer) {
var FUNCTION_TABLE_vi = [ vi, vi, vi, vi, vi, vi, vi, vi ];
var FUNCTION_TABLE_ii = [ ii ];
- 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 };
+ return { big_negative: big_negative, pick: forgetMe, pick: exportMe, doubleCompares: doubleCompares, intOps: intOps, conversions: conversions, switcher: switcher, frem: frem, frem_float: frem_float, 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 68f5920ee..020ded163 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -33,6 +33,7 @@
(export "conversions" (func $conversions))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -245,6 +246,14 @@
(f64.const 1.2)
)
)
+ (func $frem_float (result f32)
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.const 5.5)
+ (f64.const 1.2000000476837158)
+ )
+ )
+ )
(func $i32u-div (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(get_local $1)
@@ -1217,6 +1226,11 @@
(func $ii (param $0 i32) (result i32)
(get_local $0)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64
diff --git a/test/unit.fromasm.clamp b/test/unit.fromasm.clamp
index 1442ea947..06c577753 100644
--- a/test/unit.fromasm.clamp
+++ b/test/unit.fromasm.clamp
@@ -31,6 +31,7 @@
(export "conversions" (func $conversions))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -269,6 +270,14 @@
(f64.const 1.2)
)
)
+ (func $frem_float (result f32)
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.const 5.5)
+ (f64.const 1.2000000476837158)
+ )
+ )
+ )
(func $i32u-div (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(get_local $1)
@@ -1241,6 +1250,11 @@
(func $ii (param $0 i32) (result i32)
(get_local $0)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64
diff --git a/test/unit.fromasm.clamp.no-opts b/test/unit.fromasm.clamp.no-opts
index 37456128f..393147603 100644
--- a/test/unit.fromasm.clamp.no-opts
+++ b/test/unit.fromasm.clamp.no-opts
@@ -38,6 +38,7 @@
(export "conversions" (func $conversions))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -407,6 +408,20 @@
)
)
)
+ (func $frem_float (result f32)
+ (return
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.promote/f32
+ (f32.const 5.5)
+ )
+ (f64.promote/f32
+ (f32.const 1.2000000476837158)
+ )
+ )
+ )
+ )
+ )
(func $i32u-div (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(i32.eqz
@@ -2030,6 +2045,11 @@
(get_local $x)
)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index ea664d5f0..8ee0b073f 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -30,6 +30,7 @@
(export "conversions" (func $big_negative))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -226,6 +227,14 @@
(f64.const 1.2)
)
)
+ (func $frem_float (result f32)
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.const 5.5)
+ (f64.const 1.2000000476837158)
+ )
+ )
+ )
(func $big_uint_div_u (result i32)
(i32.const 2147483647)
)
@@ -1190,6 +1199,11 @@
(func $ii (param $0 i32) (result i32)
(get_local $0)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 227cf5e79..70eece97d 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -38,6 +38,7 @@
(export "conversions" (func $conversions))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -379,6 +380,20 @@
)
)
)
+ (func $frem_float (result f32)
+ (return
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.promote/f32
+ (f32.const 5.5)
+ )
+ (f64.promote/f32
+ (f32.const 1.2000000476837158)
+ )
+ )
+ )
+ )
+ )
(func $big_uint_div_u (result i32)
(local $x i32)
(set_local $x
@@ -1990,6 +2005,11 @@
(get_local $x)
)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index 878011cef..511e310a3 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -40,6 +40,7 @@
(export "conversions" (func $conversions))
(export "switcher" (func $switcher))
(export "frem" (func $frem))
+ (export "frem_float" (func $legalstub$frem_float))
(export "big_uint_div_u" (func $big_uint_div_u))
(export "fr" (func $legalstub$fr))
(export "negZero" (func $negZero))
@@ -383,6 +384,20 @@
)
)
)
+ (func $frem_float (result f32)
+ (return
+ (f32.demote/f64
+ (call $f64-rem
+ (f64.promote/f32
+ (f32.const 5.5)
+ )
+ (f64.promote/f32
+ (f32.const 1.2000000476837158)
+ )
+ )
+ )
+ )
+ )
(func $i32u-div (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(i32.eqz
@@ -2006,6 +2021,11 @@
(get_local $x)
)
)
+ (func $legalstub$frem_float (result f64)
+ (f64.promote/f32
+ (call $frem_float)
+ )
+ )
(func $legalstub$fr (param $0 f64)
(call $fr
(f32.demote/f64