diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-05-14 20:51:35 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-05-14 11:51:35 -0700 |
commit | 689ca6b29a135b8eaa206d790f4a01562fbe5fe4 (patch) | |
tree | 718d3de280b07b662ed5424cbb45e9058976a13e /test/wasm2asm | |
parent | e086ef9ad169443b85b4d4c9d915bbd378276552 (diff) | |
download | binaryen-689ca6b29a135b8eaa206d790f4a01562fbe5fe4.tar.gz binaryen-689ca6b29a135b8eaa206d790f4a01562fbe5fe4.tar.bz2 binaryen-689ca6b29a135b8eaa206d790f4a01562fbe5fe4.zip |
wasm2asm: Add math aliases for floor, ceil and sqrt (#1549)
Diffstat (limited to 'test/wasm2asm')
-rw-r--r-- | test/wasm2asm/address.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/br_table_temp.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/empty_imported_table.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/empty_table.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/float-ops.2asm.js | 41 | ||||
-rw-r--r-- | test/wasm2asm/float-ops.wast | 20 | ||||
-rw-r--r-- | test/wasm2asm/forward.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/get-set-local.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/grow_memory.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/hello_world.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/i32.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/i64-add-sub.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/i64-lowering.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/i64-shifts.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/reinterpret.2asm.js | 3 | ||||
-rw-r--r-- | test/wasm2asm/unary-ops.2asm.js | 3 |
16 files changed, 102 insertions, 1 deletions
diff --git a/test/wasm2asm/address.2asm.js b/test/wasm2asm/address.2asm.js index a8b376951..1cc7ba73f 100644 --- a/test/wasm2asm/address.2asm.js +++ b/test/wasm2asm/address.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var print = env.print; var i64toi32_i32$HIGH_BITS = 0; function $0(i) { diff --git a/test/wasm2asm/br_table_temp.2asm.js b/test/wasm2asm/br_table_temp.2asm.js index 44153eedb..3755d7034 100644 --- a/test/wasm2asm/br_table_temp.2asm.js +++ b/test/wasm2asm/br_table_temp.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/empty_imported_table.2asm.js b/test/wasm2asm/empty_imported_table.2asm.js index 775bb4e1f..8512534fc 100644 --- a/test/wasm2asm/empty_imported_table.2asm.js +++ b/test/wasm2asm/empty_imported_table.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var import$table$0 = env.table; var i64toi32_i32$HIGH_BITS = 0; function __wasm_ctz_i32(x) { diff --git a/test/wasm2asm/empty_table.2asm.js b/test/wasm2asm/empty_table.2asm.js index ba5ebd6c7..af11b1a6a 100644 --- a/test/wasm2asm/empty_table.2asm.js +++ b/test/wasm2asm/empty_table.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function __wasm_ctz_i32(x) { x = x | 0; diff --git a/test/wasm2asm/float-ops.2asm.js b/test/wasm2asm/float-ops.2asm.js index e2dd5d528..fceaa7985 100644 --- a/test/wasm2asm/float-ops.2asm.js +++ b/test/wasm2asm/float-ops.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { @@ -173,6 +176,36 @@ function asmFunc(global, env, buffer) { return Math_fround(Math_fround($0)); } + function $27($0) { + $0 = Math_fround($0); + return Math_fround(Math_fround(Math_floor($0))); + } + + function $28($0) { + $0 = Math_fround($0); + return Math_fround(Math_fround(Math_ceil($0))); + } + + function $29($0) { + $0 = +$0; + return +Math_floor($0); + } + + function $30($0) { + $0 = +$0; + return +Math_ceil($0); + } + + function $31($0) { + $0 = Math_fround($0); + return Math_fround(Math_fround(Math_sqrt($0))); + } + + function $32($0) { + $0 = +$0; + return +Math_sqrt($0); + } + function __wasm_ctz_i32(x) { x = x | 0; var $1 = 0; @@ -235,7 +268,13 @@ function asmFunc(global, env, buffer) { f64_min: $23, f64_max: $24, f64_promote: $25, - f32_demote: $26 + f32_demote: $26, + f32_floor: $27, + f32_ceil: $28, + f64_floor: $29, + f64_ceil: $30, + f32_sqrt: $31, + f64_sqrt: $32 }; } diff --git a/test/wasm2asm/float-ops.wast b/test/wasm2asm/float-ops.wast index ee8f899e8..4ca32bb49 100644 --- a/test/wasm2asm/float-ops.wast +++ b/test/wasm2asm/float-ops.wast @@ -81,4 +81,24 @@ (func (export "f32.demote") (param $0 f64) (result f32) (f32.demote/f64 (get_local $0))) + + ;; floor/ceil + (func (export "f32.floor") (param $0 f32) (result f32) + (f32.floor (get_local $0))) + + (func (export "f32.ceil") (param $0 f32) (result f32) + (f32.ceil (get_local $0))) + + (func (export "f64.floor") (param $0 f64) (result f64) + (f64.floor (get_local $0))) + + (func (export "f64.ceil") (param $0 f64) (result f64) + (f64.ceil (get_local $0))) + + ;; sqrt + (func (export "f32.sqrt") (param $0 f32) (result f32) + (f32.sqrt (get_local $0))) + + (func (export "f64.sqrt") (param $0 f64) (result f64) + (f64.sqrt (get_local $0))) ) diff --git a/test/wasm2asm/forward.2asm.js b/test/wasm2asm/forward.2asm.js index d0ddd82dc..c5b382f88 100644 --- a/test/wasm2asm/forward.2asm.js +++ b/test/wasm2asm/forward.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function even(n) { n = n | 0; diff --git a/test/wasm2asm/get-set-local.2asm.js b/test/wasm2asm/get-set-local.2asm.js index e7203c9cd..f02fa2cdf 100644 --- a/test/wasm2asm/get-set-local.2asm.js +++ b/test/wasm2asm/get-set-local.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/grow_memory.2asm.js b/test/wasm2asm/grow_memory.2asm.js index 8f58b544e..48865ce48 100644 --- a/test/wasm2asm/grow_memory.2asm.js +++ b/test/wasm2asm/grow_memory.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function $0(var$0) { var$0 = var$0 | 0; diff --git a/test/wasm2asm/hello_world.2asm.js b/test/wasm2asm/hello_world.2asm.js index 8baa490cf..f511df931 100644 --- a/test/wasm2asm/hello_world.2asm.js +++ b/test/wasm2asm/hello_world.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function add(x, y) { x = x | 0; diff --git a/test/wasm2asm/i32.2asm.js b/test/wasm2asm/i32.2asm.js index d488213fd..6fab2d7f6 100644 --- a/test/wasm2asm/i32.2asm.js +++ b/test/wasm2asm/i32.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function $0(x, y) { x = x | 0; diff --git a/test/wasm2asm/i64-add-sub.2asm.js b/test/wasm2asm/i64-add-sub.2asm.js index d9c2a389b..550c08a67 100644 --- a/test/wasm2asm/i64-add-sub.2asm.js +++ b/test/wasm2asm/i64-add-sub.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/i64-lowering.2asm.js b/test/wasm2asm/i64-lowering.2asm.js index 323abd13e..03fe8b2e6 100644 --- a/test/wasm2asm/i64-lowering.2asm.js +++ b/test/wasm2asm/i64-lowering.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/i64-shifts.2asm.js b/test/wasm2asm/i64-shifts.2asm.js index aa2c53512..ec79804e5 100644 --- a/test/wasm2asm/i64-shifts.2asm.js +++ b/test/wasm2asm/i64-shifts.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/reinterpret.2asm.js b/test/wasm2asm/reinterpret.2asm.js index 3d770efe1..2cbd597f6 100644 --- a/test/wasm2asm/reinterpret.2asm.js +++ b/test/wasm2asm/reinterpret.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { diff --git a/test/wasm2asm/unary-ops.2asm.js b/test/wasm2asm/unary-ops.2asm.js index 293aa8d0b..ccd55fbe6 100644 --- a/test/wasm2asm/unary-ops.2asm.js +++ b/test/wasm2asm/unary-ops.2asm.js @@ -14,6 +14,9 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; var Math_min = global.Math.min; var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; var i64toi32_i32$HIGH_BITS = 0; function dummy() { |