forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
i64-add-sub.wast
66 lines (61 loc) · 3.43 KB
/
i64-add-sub.wast
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 (local.get $0) (local.get $1)) (local.get $r)))
(func (export "check_sub_i64") (param $0 i64) (param $1 i64) (param $r i64) (result i32)
(i64.eq (i64.sub (local.get $0) (local.get $1)) (local.get $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))