diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit.asm.js | 7 | ||||
-rw-r--r-- | test/unit.fromasm | 4 | ||||
-rw-r--r-- | test/unit.fromasm.clamp | 4 | ||||
-rw-r--r-- | test/unit.fromasm.clamp.no-opts | 38 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 7 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise.no-opts | 13 | ||||
-rw-r--r-- | test/unit.fromasm.no-opts | 38 |
7 files changed, 110 insertions, 1 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js index ca7ac90e9..82b6bdcd1 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -150,6 +150,11 @@ function asm(global, env, buffer) { x = (4294967295 / 2)&-1; return x | 0; } + function trapping_sint_div_s() { + var x = 0; + x = (-2147483648 / -1); + return x | 0; + } function fr(x) { x = Math_fround(x); var y = Math_fround(0), z = 0.0; @@ -790,6 +795,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, 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, loophi2b: loophi2b, 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, trapping_sint_div_s: trapping_sint_div_s, 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, loophi2b: loophi2b, 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 1588f651b..549541713 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -36,6 +36,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -254,6 +255,9 @@ (func $big_uint_div_u (result i32) (i32.const 2147483647) ) + (func $trapping_sint_div_s (result i32) + (i32.const 0) + ) (func $fr (param $0 f32) (nop) ) diff --git a/test/unit.fromasm.clamp b/test/unit.fromasm.clamp index c4f133481..4b8a24d23 100644 --- a/test/unit.fromasm.clamp +++ b/test/unit.fromasm.clamp @@ -34,6 +34,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -302,6 +303,9 @@ (func $big_uint_div_u (result i32) (i32.const 2147483647) ) + (func $trapping_sint_div_s (result i32) + (i32.const 0) + ) (func $fr (param $0 f32) (nop) ) diff --git a/test/unit.fromasm.clamp.no-opts b/test/unit.fromasm.clamp.no-opts index b1b22cf66..6342644e8 100644 --- a/test/unit.fromasm.clamp.no-opts +++ b/test/unit.fromasm.clamp.no-opts @@ -41,6 +41,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -477,6 +478,43 @@ (get_local $x) ) ) + (func $i32s-div (param $0 i32) (param $1 i32) (result i32) + (if (result i32) + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (if (result i32) + (i32.and + (i32.eq + (get_local $0) + (i32.const -2147483648) + ) + (i32.eq + (get_local $1) + (i32.const -1) + ) + ) + (i32.const 0) + (i32.div_s + (get_local $0) + (get_local $1) + ) + ) + ) + ) + (func $trapping_sint_div_s (result i32) + (local $x i32) + (set_local $x + (call $i32s-div + (i32.const -2147483648) + (i32.const -1) + ) + ) + (return + (get_local $x) + ) + ) (func $fr (param $x f32) (local $y f32) (local $z f64) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index fec7e2038..2f9c35d13 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -33,6 +33,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -240,6 +241,12 @@ (func $big_uint_div_u (result i32) (i32.const 2147483647) ) + (func $trapping_sint_div_s (result i32) + (i32.div_s + (i32.const -2147483648) + (i32.const -1) + ) + ) (func $fr (param $0 f32) (nop) ) diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index 76934df4b..5c3695a23 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -41,6 +41,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -413,6 +414,18 @@ (get_local $x) ) ) + (func $trapping_sint_div_s (result i32) + (local $x i32) + (set_local $x + (i32.div_s + (i32.const -2147483648) + (i32.const -1) + ) + ) + (return + (get_local $x) + ) + ) (func $fr (param $x f32) (local $y f32) (local $z f64) diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index 021ce41f9..eda573fbd 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -43,6 +43,7 @@ (export "frem" (func $frem)) (export "frem_float" (func $legalstub$frem_float)) (export "big_uint_div_u" (func $big_uint_div_u)) + (export "trapping_sint_div_s" (func $trapping_sint_div_s)) (export "fr" (func $legalstub$fr)) (export "negZero" (func $negZero)) (export "neg" (func $neg)) @@ -429,6 +430,43 @@ (get_local $x) ) ) + (func $i32s-div (param $0 i32) (param $1 i32) (result i32) + (if (result i32) + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (if (result i32) + (i32.and + (i32.eq + (get_local $0) + (i32.const -2147483648) + ) + (i32.eq + (get_local $1) + (i32.const -1) + ) + ) + (i32.const 0) + (i32.div_s + (get_local $0) + (get_local $1) + ) + ) + ) + ) + (func $trapping_sint_div_s (result i32) + (local $x i32) + (set_local $x + (call $i32s-div + (i32.const -2147483648) + (i32.const -1) + ) + ) + (return + (get_local $x) + ) + ) (func $fr (param $x f32) (local $y f32) (local $z f64) |