summaryrefslogtreecommitdiff
path: root/test/noffi_f32.fromasm.clamp
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2017-05-01 17:55:02 -0500
committerAlon Zakai <alonzakai@gmail.com>2017-05-01 15:55:02 -0700
commit6ae56e73d0eb3a5769af3920a2e75e0a910777bb (patch)
tree667ddee347a6e15cef6f2811f1b8f1e03a9dd3a2 /test/noffi_f32.fromasm.clamp
parentb6d42e0c28460667d9e9c992833be668d0897362 (diff)
downloadbinaryen-6ae56e73d0eb3a5769af3920a2e75e0a910777bb.tar.gz
binaryen-6ae56e73d0eb3a5769af3920a2e75e0a910777bb.tar.bz2
binaryen-6ae56e73d0eb3a5769af3920a2e75e0a910777bb.zip
--no-js-ffi opt to disable JS FFI mangling. (#984)
* Always use scripts.test.shared for bin paths. Update scripts/test/shared.py to add WASM_MERGE relative to build directory. Update auto_update_tests.py to use scripts.test.shared variables for all bin paths. Update check.py to use scripts.test.shared for wasm-merge path (this was missing). This allows check.py and auto_update_tests.py to be run from the source directory using built binaries in a different location. * --no-legalize-javascript-ffi disables JS FFI mangling. For JS/Web platform, calls to JS imports are wrapped to convert i64 to i32 and f32 to f64. Likewise calls from JS into exports do the inverse wrapping. This change provides an option to disable that wrapping and use the original types for the call. Includes tests test/noffi_f32.asm.js and test/noffi_i64.asm.js to make sure neither f32->f64 nor i64->i32 type mangling is happening when --no-legalize-javascript-ffi is specified. To fully disable JS FFI mangling when using emscripten, the fastcomp FFI mangling must also be disabled using the -emscripten-legalize-javascript-ffi=0 flag.
Diffstat (limited to 'test/noffi_f32.fromasm.clamp')
-rw-r--r--test/noffi_f32.fromasm.clamp25
1 files changed, 25 insertions, 0 deletions
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)
+ )
+)