|
1 | 1 | ;; Test globals
|
2 | 2 |
|
3 | 3 | (module
|
| 4 | + (global (import "spectest" "global_i32") i32) |
| 5 | + (global (import "spectest" "global_i64") i64) |
| 6 | + |
4 | 7 | (global $a i32 (i32.const -2))
|
5 |
| - (global (;1;) f32 (f32.const -3)) |
6 |
| - (global (;2;) f64 (f64.const -4)) |
| 8 | + (global (;3;) f32 (f32.const -3)) |
| 9 | + (global (;4;) f64 (f64.const -4)) |
7 | 10 | (global $b i64 (i64.const -5))
|
8 | 11 |
|
9 | 12 | (global $x (mut i32) (i32.const -12))
|
10 |
| - (global (;5;) (mut f32) (f32.const -13)) |
11 |
| - (global (;6;) (mut f64) (f64.const -14)) |
| 13 | + (global (;7;) (mut f32) (f32.const -13)) |
| 14 | + (global (;8;) (mut f64) (f64.const -14)) |
12 | 15 | (global $y (mut i64) (i64.const -15))
|
13 | 16 |
|
| 17 | + (global $z1 i32 (global.get 0)) |
| 18 | + (global $z2 i64 (global.get 1)) |
| 19 | + (global $z3 i32 (i32.add (i32.sub (i32.mul (i32.const 20) (i32.const 2)) (i32.const 2)) (i32.const 4))) |
| 20 | + (global $z4 i64 (i64.add (i64.sub (i64.mul (i64.const 20) (i64.const 2)) (i64.const 2)) (i64.const 5))) |
| 21 | + (global $z5 i32 (i32.add (global.get 0) (i32.const 42))) |
| 22 | + (global $z6 i64 (i64.add (global.get 1) (i64.const 42))) |
| 23 | + |
| 24 | + |
14 | 25 | (func (export "get-a") (result i32) (global.get $a))
|
15 | 26 | (func (export "get-b") (result i64) (global.get $b))
|
16 | 27 | (func (export "get-x") (result i32) (global.get $x))
|
17 | 28 | (func (export "get-y") (result i64) (global.get $y))
|
| 29 | + (func (export "get-z1") (result i32) (global.get $z1)) |
| 30 | + (func (export "get-z2") (result i64) (global.get $z2)) |
| 31 | + (func (export "get-z3") (result i32) (global.get $z3)) |
| 32 | + (func (export "get-z4") (result i64) (global.get $z4)) |
| 33 | + (func (export "get-z5") (result i32) (global.get $z5)) |
| 34 | + (func (export "get-z6") (result i64) (global.get $z6)) |
18 | 35 | (func (export "set-x") (param i32) (global.set $x (local.get 0)))
|
19 | 36 | (func (export "set-y") (param i64) (global.set $y (local.get 0)))
|
20 | 37 |
|
21 |
| - (func (export "get-1") (result f32) (global.get 1)) |
22 |
| - (func (export "get-2") (result f64) (global.get 2)) |
23 |
| - (func (export "get-5") (result f32) (global.get 5)) |
24 |
| - (func (export "get-6") (result f64) (global.get 6)) |
25 |
| - (func (export "set-5") (param f32) (global.set 5 (local.get 0))) |
26 |
| - (func (export "set-6") (param f64) (global.set 6 (local.get 0))) |
| 38 | + (func (export "get-3") (result f32) (global.get 3)) |
| 39 | + (func (export "get-4") (result f64) (global.get 4)) |
| 40 | + (func (export "get-7") (result f32) (global.get 7)) |
| 41 | + (func (export "get-8") (result f64) (global.get 8)) |
| 42 | + (func (export "set-7") (param f32) (global.set 7 (local.get 0))) |
| 43 | + (func (export "set-8") (param f64) (global.set 8 (local.get 0))) |
27 | 44 |
|
28 | 45 | ;; As the argument of control constructs and instructions
|
29 | 46 |
|
|
182 | 199 | (assert_return (invoke "get-b") (i64.const -5))
|
183 | 200 | (assert_return (invoke "get-x") (i32.const -12))
|
184 | 201 | (assert_return (invoke "get-y") (i64.const -15))
|
185 |
| - |
186 |
| -(assert_return (invoke "get-1") (f32.const -3)) |
187 |
| -(assert_return (invoke "get-2") (f64.const -4)) |
188 |
| -(assert_return (invoke "get-5") (f32.const -13)) |
189 |
| -(assert_return (invoke "get-6") (f64.const -14)) |
| 202 | +(assert_return (invoke "get-z1") (i32.const 666)) |
| 203 | +(assert_return (invoke "get-z2") (i64.const 666)) |
| 204 | +(assert_return (invoke "get-z3") (i32.const 42)) |
| 205 | +(assert_return (invoke "get-z4") (i64.const 43)) |
| 206 | +(assert_return (invoke "get-z5") (i32.const 708)) |
| 207 | +(assert_return (invoke "get-z6") (i64.const 708)) |
| 208 | + |
| 209 | +(assert_return (invoke "get-3") (f32.const -3)) |
| 210 | +(assert_return (invoke "get-4") (f64.const -4)) |
| 211 | +(assert_return (invoke "get-7") (f32.const -13)) |
| 212 | +(assert_return (invoke "get-8") (f64.const -14)) |
190 | 213 |
|
191 | 214 | (assert_return (invoke "set-x" (i32.const 6)))
|
192 | 215 | (assert_return (invoke "set-y" (i64.const 7)))
|
193 |
| -(assert_return (invoke "set-5" (f32.const 8))) |
194 |
| -(assert_return (invoke "set-6" (f64.const 9))) |
| 216 | +(assert_return (invoke "set-7" (f32.const 8))) |
| 217 | +(assert_return (invoke "set-8" (f64.const 9))) |
195 | 218 |
|
196 | 219 | (assert_return (invoke "get-x") (i32.const 6))
|
197 | 220 | (assert_return (invoke "get-y") (i64.const 7))
|
198 |
| -(assert_return (invoke "get-5") (f32.const 8)) |
199 |
| -(assert_return (invoke "get-6") (f64.const 9)) |
| 221 | +(assert_return (invoke "get-7") (f32.const 8)) |
| 222 | +(assert_return (invoke "get-8") (f64.const 9)) |
200 | 223 |
|
201 | 224 | (assert_return (invoke "as-select-first") (i32.const 6))
|
202 | 225 | (assert_return (invoke "as-select-mid") (i32.const 2))
|
|
0 commit comments