blob: 5a1ca36f192776ca17a31f894418288f7b4725b7 [file] [edit]
(module
(type $0 (func (param i32 i64)))
(type $1 (func (param f32)))
(type $2 (func (param f64)))
(type $FUNCSIG$id (func (param f64) (result i32)))
(import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32)))
(func $test_div (; 1 ;) (type $0) (param $0 i32) (param $1 i64)
(drop
(call $i32s-div
(get_local $0)
(get_local $0)
)
)
(drop
(call $i32u-div
(get_local $0)
(get_local $0)
)
)
(drop
(call $i64s-div
(get_local $1)
(get_local $1)
)
)
(drop
(call $i64u-div
(get_local $1)
(get_local $1)
)
)
)
(func $test_rem (; 2 ;) (type $0) (param $0 i32) (param $1 i64)
(drop
(call $i32s-rem
(get_local $0)
(get_local $0)
)
)
(drop
(call $i32u-rem
(get_local $0)
(get_local $0)
)
)
(drop
(call $i64s-rem
(get_local $1)
(get_local $1)
)
)
(drop
(call $i64u-rem
(get_local $1)
(get_local $1)
)
)
)
(func $test_f32_to_int (; 3 ;) (type $1) (param $0 f32)
(drop
(call $f64-to-int
(f64.promote/f32
(get_local $0)
)
)
)
(drop
(call $f64-to-int
(f64.promote/f32
(get_local $0)
)
)
)
(drop
(call $f32-to-int64
(get_local $0)
)
)
(drop
(call $f32-to-uint64
(get_local $0)
)
)
)
(func $test_f64_to_int (; 4 ;) (type $2) (param $0 f64)
(drop
(call $f64-to-int
(get_local $0)
)
)
(drop
(call $f64-to-int
(get_local $0)
)
)
(drop
(call $f64-to-int64
(get_local $0)
)
)
(drop
(call $f64-to-uint64
(get_local $0)
)
)
)
(func $f32-to-int64 (; 5 ;) (param $0 f32) (result i64)
(if (result i64)
(f32.ne
(get_local $0)
(get_local $0)
)
(i64.const -9223372036854775808)
(if (result i64)
(f32.ge
(get_local $0)
(f32.const 9223372036854775808)
)
(i64.const -9223372036854775808)
(if (result i64)
(f32.le
(get_local $0)
(f32.const -9223372036854775808)
)
(i64.const -9223372036854775808)
(i64.trunc_s/f32
(get_local $0)
)
)
)
)
)
(func $f32-to-uint64 (; 6 ;) (param $0 f32) (result i64)
(if (result i64)
(f32.ne
(get_local $0)
(get_local $0)
)
(i64.const 0)
(if (result i64)
(f32.ge
(get_local $0)
(f32.const 18446744073709551615)
)
(i64.const 0)
(if (result i64)
(f32.le
(get_local $0)
(f32.const -1)
)
(i64.const 0)
(i64.trunc_u/f32
(get_local $0)
)
)
)
)
)
(func $f64-to-int64 (; 7 ;) (param $0 f64) (result i64)
(if (result i64)
(f64.ne
(get_local $0)
(get_local $0)
)
(i64.const -9223372036854775808)
(if (result i64)
(f64.ge
(get_local $0)
(f64.const 9223372036854775808)
)
(i64.const -9223372036854775808)
(if (result i64)
(f64.le
(get_local $0)
(f64.const -9223372036854775808)
)
(i64.const -9223372036854775808)
(i64.trunc_s/f64
(get_local $0)
)
)
)
)
)
(func $f64-to-uint64 (; 8 ;) (param $0 f64) (result i64)
(if (result i64)
(f64.ne
(get_local $0)
(get_local $0)
)
(i64.const 0)
(if (result i64)
(f64.ge
(get_local $0)
(f64.const 18446744073709551615)
)
(i64.const 0)
(if (result i64)
(f64.le
(get_local $0)
(f64.const -1)
)
(i64.const 0)
(i64.trunc_u/f64
(get_local $0)
)
)
)
)
)
(func $i32s-div (; 9 ;) (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 $i32s-rem (; 10 ;) (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(i32.eqz
(get_local $1)
)
(i32.const 0)
(i32.rem_s
(get_local $0)
(get_local $1)
)
)
)
(func $i32u-div (; 11 ;) (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(i32.eqz
(get_local $1)
)
(i32.const 0)
(i32.div_u
(get_local $0)
(get_local $1)
)
)
)
(func $i32u-rem (; 12 ;) (param $0 i32) (param $1 i32) (result i32)
(if (result i32)
(i32.eqz
(get_local $1)
)
(i32.const 0)
(i32.rem_u
(get_local $0)
(get_local $1)
)
)
)
(func $i64s-div (; 13 ;) (param $0 i64) (param $1 i64) (result i64)
(if (result i64)
(i64.eqz
(get_local $1)
)
(i64.const 0)
(if (result i64)
(i32.and
(i64.eq
(get_local $0)
(i64.const -9223372036854775808)
)
(i64.eq
(get_local $1)
(i64.const -1)
)
)
(i64.const 0)
(i64.div_s
(get_local $0)
(get_local $1)
)
)
)
)
(func $i64s-rem (; 14 ;) (param $0 i64) (param $1 i64) (result i64)
(if (result i64)
(i64.eqz
(get_local $1)
)
(i64.const 0)
(i64.rem_s
(get_local $0)
(get_local $1)
)
)
)
(func $i64u-div (; 15 ;) (param $0 i64) (param $1 i64) (result i64)
(if (result i64)
(i64.eqz
(get_local $1)
)
(i64.const 0)
(i64.div_u
(get_local $0)
(get_local $1)
)
)
)
(func $i64u-rem (; 16 ;) (param $0 i64) (param $1 i64) (result i64)
(if (result i64)
(i64.eqz
(get_local $1)
)
(i64.const 0)
(i64.rem_u
(get_local $0)
(get_local $1)
)
)
)
)