summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/noffi_f32.asm.js21
-rw-r--r--test/noffi_f32.fromasm25
-rw-r--r--test/noffi_f32.fromasm.clamp25
-rw-r--r--test/noffi_f32.fromasm.clamp.no-opts28
-rw-r--r--test/noffi_f32.fromasm.imprecise24
-rw-r--r--test/noffi_f32.fromasm.imprecise.no-opts28
-rw-r--r--test/noffi_f32.fromasm.no-opts28
-rw-r--r--test/noffi_i64.asm.js21
-rw-r--r--test/noffi_i64.fromasm25
-rw-r--r--test/noffi_i64.fromasm.clamp25
-rw-r--r--test/noffi_i64.fromasm.clamp.no-opts32
-rw-r--r--test/noffi_i64.fromasm.imprecise24
-rw-r--r--test/noffi_i64.fromasm.imprecise.no-opts32
-rw-r--r--test/noffi_i64.fromasm.no-opts32
14 files changed, 370 insertions, 0 deletions
diff --git a/test/noffi_f32.asm.js b/test/noffi_f32.asm.js
new file mode 100644
index 000000000..cc7a47972
--- /dev/null
+++ b/test/noffi_f32.asm.js
@@ -0,0 +1,21 @@
+function(global, env, buffer) {
+ "use asm";
+ var Math_fround=global.Math.fround;
+ var importf=env._importf;
+
+ function exportf(a){
+ a=Math_fround(a);
+ return Math_fround(a+Math_fround(1.0))
+ }
+ function main(){
+ Math_fround(importf(Math_fround(3.4000000953674316)));
+ return 0
+ }
+
+ return{
+ main:main,
+ exportf:exportf}
+}
+
+;
+
diff --git a/test/noffi_f32.fromasm b/test/noffi_f32.fromasm
new file mode 100644
index 000000000..4236c215f
--- /dev/null
+++ b/test/noffi_f32.fromasm
@@ -0,0 +1,25 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (data (get_global $memoryBase) "noffi_f32.asm.js")
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $0 f32) (result f32)
+ (f32.add
+ (get_local $0)
+ (f32.const 1)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_f32.fromasm.clamp b/test/noffi_f32.fromasm.clamp
new file mode 100644
index 000000000..4236c215f
--- /dev/null
+++ b/test/noffi_f32.fromasm.clamp
@@ -0,0 +1,25 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (data (get_global $memoryBase) "noffi_f32.asm.js")
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $0 f32) (result f32)
+ (f32.add
+ (get_local $0)
+ (f32.const 1)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_f32.fromasm.clamp.no-opts b/test/noffi_f32.fromasm.clamp.no-opts
new file mode 100644
index 000000000..3e6d142c0
--- /dev/null
+++ b/test/noffi_f32.fromasm.clamp.no-opts
@@ -0,0 +1,28 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $a f32) (result f32)
+ (return
+ (f32.add
+ (get_local $a)
+ (f32.const 1)
+ )
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/noffi_f32.fromasm.imprecise b/test/noffi_f32.fromasm.imprecise
new file mode 100644
index 000000000..5553a036a
--- /dev/null
+++ b/test/noffi_f32.fromasm.imprecise
@@ -0,0 +1,24 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $0 f32) (result f32)
+ (f32.add
+ (get_local $0)
+ (f32.const 1)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_f32.fromasm.imprecise.no-opts b/test/noffi_f32.fromasm.imprecise.no-opts
new file mode 100644
index 000000000..3e6d142c0
--- /dev/null
+++ b/test/noffi_f32.fromasm.imprecise.no-opts
@@ -0,0 +1,28 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $a f32) (result f32)
+ (return
+ (f32.add
+ (get_local $a)
+ (f32.const 1)
+ )
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/noffi_f32.fromasm.no-opts b/test/noffi_f32.fromasm.no-opts
new file mode 100644
index 000000000..3e6d142c0
--- /dev/null
+++ b/test/noffi_f32.fromasm.no-opts
@@ -0,0 +1,28 @@
+(module
+ (type $FUNCSIG$ff (func (param f32) (result f32)))
+ (import "env" "_importf" (func $importf (param f32) (result f32)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "main" (func $main))
+ (export "exportf" (func $exportf))
+ (func $exportf (param $a f32) (result f32)
+ (return
+ (f32.add
+ (get_local $a)
+ (f32.const 1)
+ )
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importf
+ (f32.const 3.4000000953674316)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/noffi_i64.asm.js b/test/noffi_i64.asm.js
new file mode 100644
index 000000000..304d70fc0
--- /dev/null
+++ b/test/noffi_i64.asm.js
@@ -0,0 +1,21 @@
+function(global, env, buffer) {
+ "use asm";
+ var importll=env._importll;
+
+ function add(a,b) {
+ a = i64(a);
+ b = i64(b);
+ var c = i64();
+ c = i64_add(b,a);
+ return (i64(c));
+ }
+ function main() {
+ (i64(importll(i64_const(2,0))));
+ return 0;
+ }
+
+ return {
+ _add: add,
+ _main: main };
+}
+;
diff --git a/test/noffi_i64.fromasm b/test/noffi_i64.fromasm
new file mode 100644
index 000000000..65aacd9d3
--- /dev/null
+++ b/test/noffi_i64.fromasm
@@ -0,0 +1,25 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (data (get_global $memoryBase) "noffi_i64.asm.js")
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $0 i64) (param $1 i64) (result i64)
+ (i64.add
+ (get_local $1)
+ (get_local $0)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_i64.fromasm.clamp b/test/noffi_i64.fromasm.clamp
new file mode 100644
index 000000000..65aacd9d3
--- /dev/null
+++ b/test/noffi_i64.fromasm.clamp
@@ -0,0 +1,25 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (data (get_global $memoryBase) "noffi_i64.asm.js")
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $0 i64) (param $1 i64) (result i64)
+ (i64.add
+ (get_local $1)
+ (get_local $0)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_i64.fromasm.clamp.no-opts b/test/noffi_i64.fromasm.clamp.no-opts
new file mode 100644
index 000000000..f6fd65454
--- /dev/null
+++ b/test/noffi_i64.fromasm.clamp.no-opts
@@ -0,0 +1,32 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $a i64) (param $b i64) (result i64)
+ (local $c i64)
+ (set_local $c
+ (i64.add
+ (get_local $b)
+ (get_local $a)
+ )
+ )
+ (return
+ (get_local $c)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/noffi_i64.fromasm.imprecise b/test/noffi_i64.fromasm.imprecise
new file mode 100644
index 000000000..925e29862
--- /dev/null
+++ b/test/noffi_i64.fromasm.imprecise
@@ -0,0 +1,24 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $0 i64) (param $1 i64) (result i64)
+ (i64.add
+ (get_local $1)
+ (get_local $0)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (i32.const 0)
+ )
+)
diff --git a/test/noffi_i64.fromasm.imprecise.no-opts b/test/noffi_i64.fromasm.imprecise.no-opts
new file mode 100644
index 000000000..f6fd65454
--- /dev/null
+++ b/test/noffi_i64.fromasm.imprecise.no-opts
@@ -0,0 +1,32 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $a i64) (param $b i64) (result i64)
+ (local $c i64)
+ (set_local $c
+ (i64.add
+ (get_local $b)
+ (get_local $a)
+ )
+ )
+ (return
+ (get_local $c)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)
diff --git a/test/noffi_i64.fromasm.no-opts b/test/noffi_i64.fromasm.no-opts
new file mode 100644
index 000000000..f6fd65454
--- /dev/null
+++ b/test/noffi_i64.fromasm.no-opts
@@ -0,0 +1,32 @@
+(module
+ (type $FUNCSIG$jj (func (param i64) (result i64)))
+ (import "env" "_importll" (func $importll (param i64) (result i64)))
+ (import "env" "memory" (memory $0 256 256))
+ (import "env" "table" (table 0 0 anyfunc))
+ (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "tableBase" (global $tableBase i32))
+ (export "_add" (func $add))
+ (export "_main" (func $main))
+ (func $add (param $a i64) (param $b i64) (result i64)
+ (local $c i64)
+ (set_local $c
+ (i64.add
+ (get_local $b)
+ (get_local $a)
+ )
+ )
+ (return
+ (get_local $c)
+ )
+ )
+ (func $main (result i32)
+ (drop
+ (call $importll
+ (i64.const 2)
+ )
+ )
+ (return
+ (i32.const 0)
+ )
+ )
+)