diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-12-02 20:23:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-12-07 16:50:04 -1000 |
commit | b0d3056aa9dfda88f86db9d580989372ab198f11 (patch) | |
tree | 48d9e36ad78bc7687a8950d185a1d9005fd6a437 /test | |
parent | 0a498b945e6fe51db9fd3e5b76997e3f40b735a7 (diff) | |
download | binaryen-b0d3056aa9dfda88f86db9d580989372ab198f11.tar.gz binaryen-b0d3056aa9dfda88f86db9d580989372ab198f11.tar.bz2 binaryen-b0d3056aa9dfda88f86db9d580989372ab198f11.zip |
lower min and max in asm2wasm in wasm f*.min/max
Diffstat (limited to 'test')
-rw-r--r-- | test/unit.asm.js | 9 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise.no-opts | 30 | ||||
-rw-r--r-- | test/unit.fromasm.no-opts | 30 |
3 files changed, 69 insertions, 0 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js index 385db859c..a865350f6 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -7,6 +7,8 @@ function asm(global, env, buffer) { var Math_fround = global.Math.fround; var Math_abs = global.Math.abs; var Math_ceil = global.Math.ceil; + var Math_max = global.Math.max; + var Math_min = global.Math.min; var tempDoublePtr = env.tempDoublePtr | 0; var n = env.gb | 0; var STACKTOP = env.STACKTOP | 0; @@ -158,6 +160,13 @@ function asm(global, env, buffer) { y = +Math_abs(0.0); z = Math_fround(Math_abs(Math_fround(0))); } + function minmax() { + var x = 0.0, y = 0.0, z = Math_fround(0), w = Math_fround(0); + x = +Math_min(+x, +y); + y = +Math_max(+x, +y); + z = Math_fround(Math_min(Math_fround(z), Math_fround(w))); + w = Math_fround(Math_max(Math_fround(z), Math_fround(w))); + } function neg() { var x = Math_fround(0); x = Math_fround(-x); diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index b79ff2389..fe2e7edbd 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -456,6 +456,36 @@ ) ) ) + (func $minmax + (local $x f64) + (local $y f64) + (local $z f32) + (local $w f32) + (set_local $x + (f64.min + (get_local $x) + (get_local $y) + ) + ) + (set_local $y + (f64.max + (get_local $x) + (get_local $y) + ) + ) + (set_local $z + (f32.min + (get_local $z) + (get_local $w) + ) + ) + (set_local $w + (f32.max + (get_local $z) + (get_local $w) + ) + ) + ) (func $neg (local $x f32) (set_local $x diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index 717b6a4c4..960ee6c5f 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -462,6 +462,36 @@ ) ) ) + (func $minmax + (local $x f64) + (local $y f64) + (local $z f32) + (local $w f32) + (set_local $x + (f64.min + (get_local $x) + (get_local $y) + ) + ) + (set_local $y + (f64.max + (get_local $x) + (get_local $y) + ) + ) + (set_local $z + (f32.min + (get_local $z) + (get_local $w) + ) + ) + (set_local $w + (f32.max + (get_local $z) + (get_local $w) + ) + ) + ) (func $neg (local $x f32) (set_local $x |