1 ; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false | FileCheck %s
3 @i32_global = local_unnamed_addr addrspace(1) global i32 undef
4 @i64_global = local_unnamed_addr addrspace(1) global i64 undef
5 @f32_global = local_unnamed_addr addrspace(1) global float undef
6 @f64_global = local_unnamed_addr addrspace(1) global double undef
8 @i32_external_used = external addrspace(1) global i32
9 @i32_external_unused = external addrspace(1) global i32
11 define i32 @return_i32_global() {
12 ; CHECK-LABEL: return_i32_global:
13 ; CHECK-NEXT: functype return_i32_global () -> (i32)
14 ; CHECK-NEXT: global.get i32_global
15 ; CHECK-NEXT: end_function
16 %v = load i32, ptr addrspace(1) @i32_global
20 define i64 @return_i64_global() {
21 ; CHECK-LABEL: return_i64_global:
22 ; CHECK-NEXT: functype return_i64_global () -> (i64)
23 ; CHECK-NEXT: global.get i64_global
24 ; CHECK-NEXT: end_function
25 %v = load i64, ptr addrspace(1) @i64_global
29 define float @return_f32_global() {
30 ; CHECK-LABEL: return_f32_global:
31 ; CHECK-NEXT: functype return_f32_global () -> (f32)
32 ; CHECK-NEXT: global.get f32_global
33 ; CHECK-NEXT: end_function
34 %v = load float, ptr addrspace(1) @f32_global
38 define double @return_f64_global() {
39 ; CHECK-LABEL: return_f64_global:
40 ; CHECK-NEXT: functype return_f64_global () -> (f64)
41 ; CHECK-NEXT: global.get f64_global
42 ; CHECK-NEXT: end_function
43 %v = load double, ptr addrspace(1) @f64_global
47 define i32 @return_extern_i32_global() {
48 ; CHECK-LABEL: return_extern_i32_global:
49 ; CHECK-NEXT: functype return_extern_i32_global () -> (i32)
50 ; CHECK-NEXT: global.get i32_external_used
51 ; CHECK-NEXT: end_function
52 %v = load i32, ptr addrspace(1) @i32_external_used
57 ; CHECK: .globaltype i32_global, i32
58 ; CHECK: .globl i32_global
59 ; CHECK-LABEL: i32_global:
61 ; CHECK: .globaltype i64_global, i64
62 ; CHECK: .globl i64_global
63 ; CHECK-LABEL: i64_global:
65 ; CHECK: .globaltype f32_global, f32
66 ; CHECK: .globl f32_global
67 ; CHECK-LABEL: f32_global:
69 ; CHECK: .globaltype f64_global, f64
70 ; CHECK: .globl f64_global
71 ; CHECK-LABEL: f64_global:
73 ; CHECK: .globaltype i32_external_used, i32
74 ; CHECK-NOT: .global i32_external_used
75 ; CHECK-NOT: i32_external_used:
77 ; CHECK: .globaltype i32_external_unused, i32
78 ; CHECK-NOT: .global i32_external_unused
79 ; CHECK-NOT: i32_external_unused: