summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/Os_print-stack-ir.txt56
-rw-r--r--test/passes/Os_print-stack-ir.wast23
-rw-r--r--test/push_pop.wast23
-rw-r--r--test/push_pop.wast.from-wast34
-rw-r--r--test/push_pop.wast.fromBinary23
-rw-r--r--test/push_pop.wast.fromBinary.noDebugInfo23
6 files changed, 182 insertions, 0 deletions
diff --git a/test/passes/Os_print-stack-ir.txt b/test/passes/Os_print-stack-ir.txt
index 73bfa261d..b559e448a 100644
--- a/test/passes/Os_print-stack-ir.txt
+++ b/test/passes/Os_print-stack-ir.txt
@@ -39,3 +39,59 @@
)
)
)
+(module
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$j (func (result i64)))
+ (type $FUNCSIG$f (func (result f32)))
+ (type $FUNCSIG$d (func (result f64)))
+ (export "ppi32" (func $0))
+ (export "ppi64" (func $1))
+ (export "ppf32" (func $2))
+ (export "ppf64" (func $3))
+ (func $0 (; 0 ;) (type $FUNCSIG$i) (result i32)
+ i32.const 1
+ )
+ (func $1 (; 1 ;) (type $FUNCSIG$j) (result i64)
+ i64.const 1
+ )
+ (func $2 (; 2 ;) (type $FUNCSIG$f) (result f32)
+ f32.const 1
+ )
+ (func $3 (; 3 ;) (type $FUNCSIG$d) (result f64)
+ f64.const 1
+ )
+)
+(module
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$j (func (result i64)))
+ (type $FUNCSIG$f (func (result f32)))
+ (type $FUNCSIG$d (func (result f64)))
+ (export "ppi32" (func $0))
+ (export "ppi64" (func $1))
+ (export "ppf32" (func $2))
+ (export "ppf64" (func $3))
+ (func $0 (; 0 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32)
+ (push
+ (i32.const 1)
+ )
+ (i32.pop)
+ )
+ (func $1 (; 1 ;) (; has Stack IR ;) (type $FUNCSIG$j) (result i64)
+ (push
+ (i64.const 1)
+ )
+ (i64.pop)
+ )
+ (func $2 (; 2 ;) (; has Stack IR ;) (type $FUNCSIG$f) (result f32)
+ (push
+ (f32.const 1)
+ )
+ (f32.pop)
+ )
+ (func $3 (; 3 ;) (; has Stack IR ;) (type $FUNCSIG$d) (result f64)
+ (push
+ (f64.const 1)
+ )
+ (f64.pop)
+ )
+)
diff --git a/test/passes/Os_print-stack-ir.wast b/test/passes/Os_print-stack-ir.wast
index 5c03b5e23..7318d8bef 100644
--- a/test/passes/Os_print-stack-ir.wast
+++ b/test/passes/Os_print-stack-ir.wast
@@ -14,3 +14,26 @@
)
)
)
+(module
+ ;; These are not quite valid usages of push/pop - they are not meant to be used
+ ;; with each other. This just tests we can emit them/handle them in the optimizer.
+ ;; Once we have proper places to use them, we can tighten up the validation and
+ ;; replace this test with something correct.
+ (func "ppi32" (result i32)
+ (push (i32.const 1))
+ (i32.pop)
+ )
+ (func "ppi64" (result i64)
+ (push (i64.const 1))
+ (i64.pop)
+ )
+ (func "ppf32" (result f32)
+ (push (f32.const 1))
+ (f32.pop)
+ )
+ (func "ppf64" (result f64)
+ (push (f64.const 1))
+ (f64.pop)
+ )
+)
+
diff --git a/test/push_pop.wast b/test/push_pop.wast
new file mode 100644
index 000000000..f40e30abe
--- /dev/null
+++ b/test/push_pop.wast
@@ -0,0 +1,23 @@
+(module
+ ;; These are not quite valid usages of push/pop - they are not meant to be used
+ ;; with each other. This just tests we can emit them/handle them in the optimizer.
+ ;; Once we have proper places to use them, we can tighten up the validation and
+ ;; replace this test with something correct.
+ (func "ppi32" (result i32)
+ (push (i32.const 1))
+ (i32.pop)
+ )
+ (func "ppi64" (result i64)
+ (push (i64.const 1))
+ (i64.pop)
+ )
+ (func "ppf32" (result f32)
+ (push (f32.const 1))
+ (f32.pop)
+ )
+ (func "ppf64" (result f64)
+ (push (f64.const 1))
+ (f64.pop)
+ )
+)
+
diff --git a/test/push_pop.wast.from-wast b/test/push_pop.wast.from-wast
new file mode 100644
index 000000000..63f21ee9c
--- /dev/null
+++ b/test/push_pop.wast.from-wast
@@ -0,0 +1,34 @@
+(module
+ (type $FUNCSIG$i (func (result i32)))
+ (type $FUNCSIG$j (func (result i64)))
+ (type $FUNCSIG$f (func (result f32)))
+ (type $FUNCSIG$d (func (result f64)))
+ (export "ppi32" (func $0))
+ (export "ppi64" (func $1))
+ (export "ppf32" (func $2))
+ (export "ppf64" (func $3))
+ (func $0 (; 0 ;) (type $FUNCSIG$i) (result i32)
+ (push
+ (i32.const 1)
+ )
+ (i32.pop)
+ )
+ (func $1 (; 1 ;) (type $FUNCSIG$j) (result i64)
+ (push
+ (i64.const 1)
+ )
+ (i64.pop)
+ )
+ (func $2 (; 2 ;) (type $FUNCSIG$f) (result f32)
+ (push
+ (f32.const 1)
+ )
+ (f32.pop)
+ )
+ (func $3 (; 3 ;) (type $FUNCSIG$d) (result f64)
+ (push
+ (f64.const 1)
+ )
+ (f64.pop)
+ )
+)
diff --git a/test/push_pop.wast.fromBinary b/test/push_pop.wast.fromBinary
new file mode 100644
index 000000000..ac6901ff3
--- /dev/null
+++ b/test/push_pop.wast.fromBinary
@@ -0,0 +1,23 @@
+(module
+ (type $0 (func (result i32)))
+ (type $1 (func (result i64)))
+ (type $2 (func (result f32)))
+ (type $3 (func (result f64)))
+ (export "ppi32" (func $0))
+ (export "ppi64" (func $1))
+ (export "ppf32" (func $2))
+ (export "ppf64" (func $3))
+ (func $0 (; 0 ;) (type $0) (result i32)
+ (i32.const 1)
+ )
+ (func $1 (; 1 ;) (type $1) (result i64)
+ (i64.const 1)
+ )
+ (func $2 (; 2 ;) (type $2) (result f32)
+ (f32.const 1)
+ )
+ (func $3 (; 3 ;) (type $3) (result f64)
+ (f64.const 1)
+ )
+)
+
diff --git a/test/push_pop.wast.fromBinary.noDebugInfo b/test/push_pop.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..ac6901ff3
--- /dev/null
+++ b/test/push_pop.wast.fromBinary.noDebugInfo
@@ -0,0 +1,23 @@
+(module
+ (type $0 (func (result i32)))
+ (type $1 (func (result i64)))
+ (type $2 (func (result f32)))
+ (type $3 (func (result f64)))
+ (export "ppi32" (func $0))
+ (export "ppi64" (func $1))
+ (export "ppf32" (func $2))
+ (export "ppf64" (func $3))
+ (func $0 (; 0 ;) (type $0) (result i32)
+ (i32.const 1)
+ )
+ (func $1 (; 1 ;) (type $1) (result i64)
+ (i64.const 1)
+ )
+ (func $2 (; 2 ;) (type $2) (result f32)
+ (f32.const 1)
+ )
+ (func $3 (; 3 ;) (type $3) (result f64)
+ (f64.const 1)
+ )
+)
+