diff options
Diffstat (limited to 'test/wasm2js/i64-add-sub.wast')
-rw-r--r-- | test/wasm2js/i64-add-sub.wast | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/wasm2js/i64-add-sub.wast b/test/wasm2js/i64-add-sub.wast new file mode 100644 index 000000000..b9ab45b79 --- /dev/null +++ b/test/wasm2js/i64-add-sub.wast @@ -0,0 +1,66 @@ +;; Testing i64 lowering for addition and subtraction. + +(module + (func $dummy) + + (func (export "check_add_i64") (param $0 i64) (param $1 i64) (param $r i64) (result i32) + (i64.eq (i64.add (get_local $0) (get_local $1)) (get_local $r))) + + (func (export "check_sub_i64") (param $0 i64) (param $1 i64) (param $r i64) (result i32) + (i64.eq (i64.sub (get_local $0) (get_local $1)) (get_local $r))) +) + +(assert_return (invoke "check_add_i64" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_add_i64" (i32.const 1) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 1) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_add_i64" (i32.const 0) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 1) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_add_i64" (i32.const 0) (i32.const 1) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "check_add_i64" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 1) + (i32.const 0) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "check_add_i64" (i32.const 0xffffffff) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 0) (i32.const 1)) + (i32.const 1)) + +;; subtraction +(assert_return (invoke "check_sub_i64" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 1) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 1) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 0) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 0xffffffff) (i32.const 0xffffffff)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 0) (i32.const 1) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 1) + (i32.const 0) (i32.const 0xffffffff)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 0xffffffff) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 0xfffffffe) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "check_sub_i64" (i32.const 0) (i32.const 1) + (i32.const 1) (i32.const 1) + (i32.const 0xffffffff) (i32.const 0xffffffff)) + (i32.const 1)) |