mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
Cast to bool by comparing to zero (#343)
This commit is contained in:
119
tests/compiler/bool.optimized.wat
Normal file
119
tests/compiler/bool.optimized.wat
Normal file
@ -0,0 +1,119 @@
|
||||
(module
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\07\00\00\00b\00o\00o\00l\00.\00t\00s")
|
||||
(table $0 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $bool/i (mut i32) (i32.const 2))
|
||||
(global $bool/I (mut i64) (i64.const 2))
|
||||
(global $bool/u (mut i32) (i32.const 2))
|
||||
(global $bool/U (mut i64) (i64.const 2))
|
||||
(global $bool/f (mut f32) (f32.const 2))
|
||||
(global $bool/F (mut f64) (f64.const 2))
|
||||
(global $bool/uu (mut i32) (i32.const 2))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $start (; 1 ;) (type $v)
|
||||
get_global $bool/i
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 2
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/I
|
||||
i32.wrap/i64
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 4
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/u
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 6
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/U
|
||||
i32.wrap/i64
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 8
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/f
|
||||
i32.trunc_u/f32
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 10
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/F
|
||||
i32.trunc_u/f64
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 12
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
get_global $bool/uu
|
||||
i32.const 0
|
||||
i32.ne
|
||||
i32.const 1
|
||||
i32.ne
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 8
|
||||
i32.const 14
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 2 ;) (type $v)
|
||||
nop
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user