summaryrefslogtreecommitdiff
path: root/test/unit.fromasm.imprecise
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit.fromasm.imprecise')
-rw-r--r--test/unit.fromasm.imprecise474
1 files changed, 438 insertions, 36 deletions
diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise
index 35b8b1768..d007a4d82 100644
--- a/test/unit.fromasm.imprecise
+++ b/test/unit.fromasm.imprecise
@@ -5,14 +5,17 @@
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$dd (func (param f64) (result f64)))
+ (type $FUNCSIG$i (func (result i32)))
(import "global" "NaN" (global $t f64))
(import "global" "Infinity" (global $u f64))
(import "env" "tempDoublePtr" (global $tempDoublePtr i32))
(import "env" "gb" (global $n i32))
+ (import "env" "STACKTOP" (global $STACKTOP i32))
(import "env" "setTempRet0" (func $setTempRet0 (param i32) (result i32)))
(import "env" "abort" (func $abort (param f64) (result f64)))
(import "env" "print" (func $print (param i32)))
(import "env" "h" (func $h (param i32)))
+ (import "env" "return_int" (func $return_int (result i32)))
(import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64)))
(import "env" "memory" (memory $memory))
(import "env" "table" (table $table))
@@ -98,13 +101,9 @@
(func $conversions
(local $0 f32)
(local $1 i32)
- (drop
- (f64.convert_s/i32
- (tee_local $1
- (i32.trunc_s/f32
- (get_local $0)
- )
- )
+ (set_local $1
+ (i32.trunc_s/f32
+ (get_local $0)
)
)
)
@@ -165,27 +164,24 @@
(block $label$break$L1
(loop $label$continue$L3
(block $label$break$L3
- (block $switch$17
- (block $switch-default$21
- (block $switch-case$20
- (block $switch-case$19
- (block $switch-case$18
- (br_table $switch-case$18 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-case$20 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-case$19 $switch-default$21
- (i32.sub
- (get_local $0)
- (i32.const -1)
- )
+ (block $switch-default$21
+ (block $switch-case$20
+ (block $switch-case$19
+ (block $switch-case$18
+ (br_table $switch-case$18 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-case$20 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-default$21 $switch-case$19 $switch-default$21
+ (i32.sub
+ (get_local $0)
+ (i32.const -1)
)
)
- (br $label$break$L1)
)
- (br $switch$17)
+ (br $label$break$L1)
)
- (br $label$break$L3)
+ (br $label$continue$L3)
)
- (br $label$break$L1)
+ (br $label$break$L3)
)
- (br $label$continue$L3)
+ (br $label$break$L1)
)
)
(call_import $h
@@ -276,23 +272,23 @@
(i32.const 1)
)
(loop $for-in$1
- (block $for-out$0
- (br_if $for-out$0
- (i32.ge_s
- (get_local $0)
- (i32.const 200)
- )
- )
- (call_import $h
+ (if
+ (i32.lt_s
(get_local $0)
+ (i32.const 200)
)
- (set_local $0
- (i32.add
+ (block
+ (call_import $h
(get_local $0)
- (i32.const 1)
)
+ (set_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const 1)
+ )
+ )
+ (br $for-in$1)
)
- (br $for-in$1)
)
)
)
@@ -469,8 +465,10 @@
(get_local $1)
(i32.const 3)
)
- (call $lb
- (i32.const 2)
+ (drop
+ (call $lb
+ (i32.const 2)
+ )
)
)
)
@@ -597,4 +595,408 @@
)
)
)
+ (func $loadSigned (param $0 i32)
+ (call $loadSigned
+ (i32.load8_s
+ (get_local $0)
+ )
+ )
+ (call $loadSigned
+ (i32.load8_s
+ (get_local $0)
+ )
+ )
+ (call $loadSigned
+ (i32.load16_s
+ (get_local $0)
+ )
+ )
+ (call $loadSigned
+ (i32.load16_s
+ (get_local $0)
+ )
+ )
+ (call $loadSigned
+ (i32.shr_s
+ (i32.shl
+ (i32.load8_s
+ (get_local $0)
+ )
+ (i32.const 24)
+ )
+ (i32.const 16)
+ )
+ )
+ (call $loadSigned
+ (i32.shr_s
+ (i32.shl
+ (i32.load8_u
+ (get_local $0)
+ )
+ (i32.const 16)
+ )
+ (i32.const 24)
+ )
+ )
+ (call $loadSigned
+ (i32.shr_s
+ (i32.shl
+ (i32.load16_s
+ (get_local $0)
+ )
+ (i32.const 16)
+ )
+ (i32.const 24)
+ )
+ )
+ (call $loadSigned
+ (i32.shr_s
+ (i32.shl
+ (i32.load16_u
+ (get_local $0)
+ )
+ (i32.const 24)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ (func $globalOpts
+ (local $0 i32)
+ (i32.store8
+ (i32.const 13)
+ (i32.load
+ (i32.const 12)
+ )
+ )
+ (call $globalOpts)
+ (set_local $0
+ (get_global $Int)
+ )
+ (if
+ (i32.const 1)
+ (set_global $Int
+ (i32.const 20)
+ )
+ )
+ (set_global $Int
+ (get_local $0)
+ )
+ (call $globalOpts)
+ (set_local $0
+ (get_global $Int)
+ )
+ (call $globalOpts)
+ (set_global $Int
+ (get_local $0)
+ )
+ )
+ (func $dropCallImport
+ (if
+ (i32.const 1)
+ (drop
+ (call_import $return_int)
+ )
+ )
+ )
+ (func $loophi (param $0 i32) (param $1 i32)
+ (local $2 i32)
+ (loop $while-in$1
+ (block $while-out$0
+ (call $loophi
+ (get_local $0)
+ (i32.const 0)
+ )
+ (if
+ (tee_local $2
+ (get_local $0)
+ )
+ (br_if $while-out$0
+ (get_local $2)
+ )
+ )
+ (br_if $while-in$1
+ (i32.eq
+ (tee_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const 1)
+ )
+ )
+ (get_local $1)
+ )
+ )
+ )
+ )
+ )
+ (func $loophi2 (result i32)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (set_local $1
+ (i32.const 0)
+ )
+ (loop $label$continue$L7
+ (block $label$break$L7
+ (set_local $0
+ (i32.const 0)
+ )
+ (loop $while-in$1
+ (set_local $2
+ (get_local $0)
+ )
+ (if
+ (i32.const 1)
+ (br_if $label$break$L7
+ (get_local $2)
+ )
+ )
+ (br_if $while-in$1
+ (tee_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (br $label$continue$L7)
+ )
+ )
+ (get_local $1)
+ )
+ (func $relooperJumpThreading (param $0 i32) (result i32)
+ (block $jumpthreading$outer$0
+ (block $jumpthreading$inner$0
+ (if
+ (get_local $0)
+ (block
+ (call_import $h
+ (i32.const 0)
+ )
+ (br $jumpthreading$inner$0)
+ )
+ )
+ (br $jumpthreading$outer$0)
+ )
+ (call_import $h
+ (i32.const 1)
+ )
+ )
+ (call_import $h
+ (i32.const -1)
+ )
+ (block $jumpthreading$inner$1
+ (loop $while-in$1
+ (br_if $while-in$1
+ (i32.eqz
+ (tee_local $0
+ (i32.add
+ (get_local $0)
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (call_import $h
+ (i32.const 2)
+ )
+ (br $jumpthreading$inner$1)
+ )
+ )
+ (call_import $h
+ (i32.const 3)
+ )
+ (call_import $h
+ (i32.const -2)
+ )
+ (block $jumpthreading$outer$3
+ (block $jumpthreading$inner$3
+ (block $jumpthreading$inner$2
+ (if
+ (get_local $0)
+ (block
+ (call_import $h
+ (i32.const 4)
+ )
+ (br_if $jumpthreading$inner$2
+ (i32.eq
+ (get_local $0)
+ (i32.const 3)
+ )
+ )
+ (br $jumpthreading$inner$3)
+ )
+ )
+ (br $jumpthreading$outer$3)
+ )
+ (call_import $h
+ (i32.const 5)
+ )
+ (br $jumpthreading$outer$3)
+ )
+ (call_import $h
+ (i32.const 6)
+ )
+ )
+ (call_import $h
+ (i32.const -3)
+ )
+ (block $jumpthreading$outer$5
+ (block $jumpthreading$inner$5
+ (block $jumpthreading$inner$4
+ (if
+ (get_local $0)
+ (block
+ (call_import $h
+ (i32.const 7)
+ )
+ (br_if $jumpthreading$inner$4
+ (i32.eq
+ (get_local $0)
+ (i32.const 5)
+ )
+ )
+ (br $jumpthreading$inner$5)
+ )
+ )
+ (br $jumpthreading$outer$5)
+ )
+ (call_import $h
+ (i32.const 8)
+ )
+ (br_if $jumpthreading$inner$5
+ (i32.eq
+ (get_local $0)
+ (i32.const 6)
+ )
+ )
+ (br $jumpthreading$outer$5)
+ )
+ (call_import $h
+ (i32.const 9)
+ )
+ )
+ (call_import $h
+ (i32.const -4)
+ )
+ (block $jumpthreading$outer$6
+ (block $jumpthreading$inner$6
+ (if
+ (get_local $0)
+ (block
+ (call_import $h
+ (i32.const 10)
+ )
+ (br $jumpthreading$inner$6)
+ )
+ )
+ (br $jumpthreading$outer$6)
+ )
+ (call_import $h
+ (i32.const 11)
+ )
+ )
+ (call_import $h
+ (i32.const -5)
+ )
+ (block $jumpthreading$outer$8
+ (block $jumpthreading$inner$8
+ (block $jumpthreading$outer$7
+ (block $jumpthreading$inner$7
+ (if
+ (get_local $0)
+ (block
+ (call_import $h
+ (i32.const 12)
+ )
+ (br_if $jumpthreading$inner$7
+ (i32.eq
+ (get_local $0)
+ (i32.const 8)
+ )
+ )
+ (br $jumpthreading$inner$8)
+ )
+ )
+ (br $jumpthreading$outer$8)
+ )
+ (call_import $h
+ (i32.const 13)
+ )
+ (br_if $jumpthreading$inner$8
+ (get_local $0)
+ )
+ )
+ (br $jumpthreading$outer$8)
+ )
+ (call_import $h
+ (i32.const 14)
+ )
+ )
+ (call_import $h
+ (i32.const -6)
+ )
+ (get_local $0)
+ )
+ (func $relooperJumpThreading__ZN4game14preloadweaponsEv
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (loop $while-in$1
+ (block $jumpthreading$outer$1
+ (block $jumpthreading$inner$1
+ (if
+ (get_local $0)
+ (br_if $jumpthreading$inner$1
+ (i32.eqz
+ (get_local $1)
+ )
+ )
+ (br_if $jumpthreading$inner$1
+ (i32.eqz
+ (get_local $2)
+ )
+ )
+ )
+ (br $while-in$1)
+ )
+ (i32.store
+ (get_local $3)
+ (get_local $4)
+ )
+ )
+ (br $while-in$1)
+ )
+ )
+ (func $__Z12multi_varargiz (param $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (if
+ (get_local $1)
+ (loop $while-in$1
+ (br_if $while-in$1
+ (i32.eqz
+ (get_local $2)
+ )
+ )
+ )
+ (drop
+ (call $lb
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (func $jumpThreadDrop (result i32)
+ (local $0 i32)
+ (set_local $0
+ (call_import $return_int)
+ )
+ (block $jumpthreading$outer$2
+ )
+ (get_local $0)
+ )
)