summaryrefslogtreecommitdiff
path: root/test/two_sides.fromasm.clamp
diff options
context:
space:
mode:
Diffstat (limited to 'test/two_sides.fromasm.clamp')
-rw-r--r--test/two_sides.fromasm.clamp86
1 files changed, 86 insertions, 0 deletions
diff --git a/test/two_sides.fromasm.clamp b/test/two_sides.fromasm.clamp
new file mode 100644
index 000000000..efc44e0b8
--- /dev/null
+++ b/test/two_sides.fromasm.clamp
@@ -0,0 +1,86 @@
+(module
+ (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) "two_sides.asm.js")
+ (export "_test" (func $_test))
+ (func $f64-to-int (param $0 f64) (result i32)
+ (if i32
+ (f64.ne
+ (get_local $0)
+ (get_local $0)
+ )
+ (i32.const -2147483648)
+ (if i32
+ (f64.ge
+ (get_local $0)
+ (f64.const 2147483648)
+ )
+ (i32.const -2147483648)
+ (if i32
+ (f64.le
+ (get_local $0)
+ (f64.const -2147483649)
+ )
+ (i32.const -2147483648)
+ (i32.trunc_s/f64
+ (get_local $0)
+ )
+ )
+ )
+ )
+ )
+ (func $_test (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
+ (local $5 f64)
+ (if i32
+ (get_local $4)
+ (call $f64-to-int
+ (f64.mul
+ (f64.add
+ (f64.convert_s/i32
+ (get_local $2)
+ )
+ (tee_local $5
+ (f64.convert_s/i32
+ (i32.mul
+ (get_local $1)
+ (get_local $0)
+ )
+ )
+ )
+ )
+ (f64.add
+ (get_local $5)
+ (f64.convert_s/i32
+ (get_local $3)
+ )
+ )
+ )
+ )
+ (call $f64-to-int
+ (f64.mul
+ (f64.add
+ (f64.convert_s/i32
+ (get_local $2)
+ )
+ (tee_local $5
+ (f64.convert_s/i32
+ (i32.mul
+ (get_local $3)
+ (get_local $2)
+ )
+ )
+ )
+ )
+ (f64.add
+ (f64.convert_s/i32
+ (get_local $3)
+ )
+ (get_local $5)
+ )
+ )
+ )
+ )
+ )
+)