diff options
author | Nathan Froyd <froydnj@gmail.com> | 2018-02-15 14:08:59 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-02-15 11:08:59 -0800 |
commit | 85ae8cc6ffeffa65ff30d17649a0d8589dab2b00 (patch) | |
tree | 9d87df46a85a6b37ca0e348bc3cdb7dea1dcd648 /test/wasm2asm/float-ops.wast | |
parent | e0f86a24bda5612fb798524df23b6071d2dccc14 (diff) | |
download | binaryen-85ae8cc6ffeffa65ff30d17649a0d8589dab2b00.tar.gz binaryen-85ae8cc6ffeffa65ff30d17649a0d8589dab2b00.tar.bz2 binaryen-85ae8cc6ffeffa65ff30d17649a0d8589dab2b00.zip |
better handling of float ops in wasm2asm (#1427)
* explicitly handle binary float operations in processFunctionBody
We weren't handling them before, but it wasn't obvious. Make the (non-)
handling of them explicit in the code. We'll add handlers for them
shortly.
* add handling for simple binary float operations
min, max, and copysign will require more sophisticated handling.
* add handling for float comparisons
* move float min/max handling to the correct place
It was previously grouped with the i32 ops.
* handle float promotion and demotion
Diffstat (limited to 'test/wasm2asm/float-ops.wast')
-rw-r--r-- | test/wasm2asm/float-ops.wast | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/wasm2asm/float-ops.wast b/test/wasm2asm/float-ops.wast new file mode 100644 index 000000000..ee8f899e8 --- /dev/null +++ b/test/wasm2asm/float-ops.wast @@ -0,0 +1,84 @@ +(module + (func $dummy) + + (func (export "f32.add") (param $0 f32) (param $1 f32) (result f32) + (f32.add (get_local $0) (get_local $1))) + + (func (export "f32.sub") (param $0 f32) (param $1 f32) (result f32) + (f32.sub (get_local $0) (get_local $1))) + + (func (export "f32.mul") (param $0 f32) (param $1 f32) (result f32) + (f32.mul (get_local $0) (get_local $1))) + + (func (export "f32.div") (param $0 f32) (param $1 f32) (result f32) + (f32.div (get_local $0) (get_local $1))) + + (func (export "f64.add") (param $0 f64) (param $1 f64) (result f64) + (f64.add (get_local $0) (get_local $1))) + + (func (export "f64.sub") (param $0 f64) (param $1 f64) (result f64) + (f64.sub (get_local $0) (get_local $1))) + + (func (export "f64.mul") (param $0 f64) (param $1 f64) (result f64) + (f64.mul (get_local $0) (get_local $1))) + + (func (export "f64.div") (param $0 f64) (param $1 f64) (result f64) + (f64.div (get_local $0) (get_local $1))) + + ;; comparisons + (func (export "f32.eq") (param $0 f32) (param $1 f32) (result i32) + (f32.eq (get_local $0) (get_local $1))) + + (func (export "f32.ne") (param $0 f32) (param $1 f32) (result i32) + (f32.ne (get_local $0) (get_local $1))) + + (func (export "f32.ge") (param $0 f32) (param $1 f32) (result i32) + (f32.ge (get_local $0) (get_local $1))) + + (func (export "f32.gt") (param $0 f32) (param $1 f32) (result i32) + (f32.gt (get_local $0) (get_local $1))) + + (func (export "f32.le") (param $0 f32) (param $1 f32) (result i32) + (f32.le (get_local $0) (get_local $1))) + + (func (export "f32.lt") (param $0 f32) (param $1 f32) (result i32) + (f32.lt (get_local $0) (get_local $1))) + + (func (export "f64.eq") (param $0 f64) (param $1 f64) (result i32) + (f64.eq (get_local $0) (get_local $1))) + + (func (export "f64.ne") (param $0 f64) (param $1 f64) (result i32) + (f64.ne (get_local $0) (get_local $1))) + + (func (export "f64.ge") (param $0 f64) (param $1 f64) (result i32) + (f64.ge (get_local $0) (get_local $1))) + + (func (export "f64.gt") (param $0 f64) (param $1 f64) (result i32) + (f64.gt (get_local $0) (get_local $1))) + + (func (export "f64.le") (param $0 f64) (param $1 f64) (result i32) + (f64.le (get_local $0) (get_local $1))) + + (func (export "f64.lt") (param $0 f64) (param $1 f64) (result i32) + (f64.lt (get_local $0) (get_local $1))) + + ;; min/max + (func (export "f32.min") (param $0 f32) (param $1 f32) (result f32) + (f32.min (get_local $0) (get_local $1))) + + (func (export "f32.max") (param $0 f32) (param $1 f32) (result f32) + (f32.max (get_local $0) (get_local $1))) + + (func (export "f64.min") (param $0 f64) (param $1 f64) (result f64) + (f64.min (get_local $0) (get_local $1))) + + (func (export "f64.max") (param $0 f64) (param $1 f64) (result f64) + (f64.max (get_local $0) (get_local $1))) + + ;; promotion/demotion + (func (export "f64.promote") (param $0 f32) (result f64) + (f64.promote/f32 (get_local $0))) + + (func (export "f32.demote") (param $0 f64) (result f32) + (f32.demote/f64 (get_local $0))) +) |