|
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 | + |
14 | 20 | (func (export "get-a") (result i32) (global.get $a)) |
15 | 21 | (func (export "get-b") (result i64) (global.get $b)) |
16 | 22 | (func (export "get-x") (result i32) (global.get $x)) |
17 | 23 | (func (export "get-y") (result i64) (global.get $y)) |
| 24 | + (func (export "get-z1") (result i32) (global.get $z1)) |
| 25 | + (func (export "get-z2") (result i64) (global.get $z2)) |
18 | 26 | (func (export "set-x") (param i32) (global.set $x (local.get 0))) |
19 | 27 | (func (export "set-y") (param i64) (global.set $y (local.get 0))) |
20 | 28 |
|
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))) |
| 29 | + (func (export "get-3") (result f32) (global.get 3)) |
| 30 | + (func (export "get-4") (result f64) (global.get 4)) |
| 31 | + (func (export "get-7") (result f32) (global.get 7)) |
| 32 | + (func (export "get-8") (result f64) (global.get 8)) |
| 33 | + (func (export "set-7") (param f32) (global.set 7 (local.get 0))) |
| 34 | + (func (export "set-8") (param f64) (global.set 8 (local.get 0))) |
27 | 35 |
|
28 | 36 | ;; As the argument of control constructs and instructions |
29 | 37 |
|
|
182 | 190 | (assert_return (invoke "get-b") (i64.const -5)) |
183 | 191 | (assert_return (invoke "get-x") (i32.const -12)) |
184 | 192 | (assert_return (invoke "get-y") (i64.const -15)) |
| 193 | +(assert_return (invoke "get-z1") (i32.const 666)) |
| 194 | +(assert_return (invoke "get-z2") (i64.const 666)) |
185 | 195 |
|
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)) |
| 196 | +(assert_return (invoke "get-3") (f32.const -3)) |
| 197 | +(assert_return (invoke "get-4") (f64.const -4)) |
| 198 | +(assert_return (invoke "get-7") (f32.const -13)) |
| 199 | +(assert_return (invoke "get-8") (f64.const -14)) |
190 | 200 |
|
191 | 201 | (assert_return (invoke "set-x" (i32.const 6))) |
192 | 202 | (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))) |
| 203 | +(assert_return (invoke "set-7" (f32.const 8))) |
| 204 | +(assert_return (invoke "set-8" (f64.const 9))) |
195 | 205 |
|
196 | 206 | (assert_return (invoke "get-x") (i32.const 6)) |
197 | 207 | (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)) |
| 208 | +(assert_return (invoke "get-7") (f32.const 8)) |
| 209 | +(assert_return (invoke "get-8") (f64.const 9)) |
200 | 210 |
|
201 | 211 | (assert_return (invoke "as-select-first") (i32.const 6)) |
202 | 212 | (assert_return (invoke "as-select-mid") (i32.const 2)) |
|
0 commit comments