Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / WebAssembly / tls.s
blob340cd5ac6a183c9ccf7bc5053277ef5ef22e2326
1 # RUN: llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s
2 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o %t.o < %s
3 # RUN: obj2yaml %t.o | FileCheck %s --check-prefix=CHECK-OBJ
5 .globaltype __tls_base, i32
7 tls_store:
8 .functype tls_store (i32) -> ()
9 # CHECK: global.get __tls_base
10 # CHECK-NEXT: i32.const tls1@TLSREL
11 # CHECK-NEXT: i32.add
12 # CHECK-NEXT: local.get 0
13 # CHECK-NEXT: i32.store 0
14 global.get __tls_base
15 i32.const tls1@TLSREL
16 i32.add
17 local.get 0
18 i32.store 0
19 end_function
21 tls_get_undefined:
22 .functype tls_get_undefined (i32) -> (i32)
23 global.get tls_undefined@GOT@TLS
24 end_function
26 .section .tls.foo,"T",@
27 # CHECK: .tls.foo,"T",@
28 tls1:
29 .int32 42
30 .size tls1, 4
32 .section custom_tls,"T",@
33 # CHECK: custom_tls,"T",@
34 tls2:
35 .int32 43
36 .size tls2, 4
38 # CHECK-OBJ: - Type: CODE
39 # CHECK-OBJ-NEXT: Relocations:
40 # CHECK-OBJ-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
41 # CHECK-OBJ-NEXT: Index: 1
42 # CHECK-OBJ-NEXT: Offset: 0x4
43 # CHECK-OBJ-NEXT: - Type: R_WASM_MEMORY_ADDR_TLS_SLEB
44 # CHECK-OBJ-NEXT: Index: 2
45 # CHECK-OBJ-NEXT: Offset: 0xA
46 # CHECK-OBJ-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
47 # CHECK-OBJ-NEXT: Index: 4
48 # CHECK-OBJ-NEXT: Offset: 0x19
50 # CHECK-OBJ: - Type: CUSTOM
51 # CHECK-OBJ-NEXT: Name: linking
52 # CHECK-OBJ-NEXT: Version: 2
53 # CHECK-OBJ-NEXT: SymbolTable:
54 # CHECK-OBJ-NEXT: - Index: 0
55 # CHECK-OBJ-NEXT: Kind: FUNCTION
56 # CHECK-OBJ-NEXT: Name: tls_store
57 # CHECK-OBJ-NEXT: Flags: [ BINDING_LOCAL ]
58 # CHECK-OBJ-NEXT: Function: 0
59 # CHECK-OBJ-NEXT: - Index: 1
60 # CHECK-OBJ-NEXT: Kind: GLOBAL
61 # CHECK-OBJ-NEXT: Name: __tls_base
62 # CHECK-OBJ-NEXT: Flags: [ UNDEFINED ]
63 # CHECK-OBJ-NEXT: Global: 0
64 # CHECK-OBJ-NEXT: - Index: 2
65 # CHECK-OBJ-NEXT: Kind: DATA
66 # CHECK-OBJ-NEXT: Name: tls1
67 # CHECK-OBJ-NEXT: Flags: [ BINDING_LOCAL, TLS ]
68 # CHECK-OBJ-NEXT: Segment: 0
69 # CHECK-OBJ-NEXT: Size: 4
70 # CHECK-OBJ-NEXT: - Index: 3
71 # CHECK-OBJ-NEXT: Kind: FUNCTION
72 # CHECK-OBJ-NEXT: Name: tls_get_undefined
73 # CHECK-OBJ-NEXT: Flags: [ BINDING_LOCAL ]
74 # CHECK-OBJ-NEXT: Function: 1
75 # CHECK-OBJ-NEXT: - Index: 4
76 # CHECK-OBJ-NEXT: Kind: DATA
77 # CHECK-OBJ-NEXT: Name: tls_undefined
78 # CHECK-OBJ-NEXT: Flags: [ UNDEFINED, TLS ]
79 # CHECK-OBJ-NEXT: - Index: 5
80 # CHECK-OBJ-NEXT: Kind: DATA
81 # CHECK-OBJ-NEXT: Name: tls2
82 # CHECK-OBJ-NEXT: Flags: [ BINDING_LOCAL, TLS ]
83 # CHECK-OBJ-NEXT: Segment: 1
84 # CHECK-OBJ-NEXT: Size: 4
85 # CHECK-OBJ-NEXT: SegmentInfo:
86 # CHECK-OBJ-NEXT: - Index: 0
87 # CHECK-OBJ-NEXT: Name: .tls.foo
88 # CHECK-OBJ-NEXT: Alignment: 0
89 # CHECK-OBJ-NEXT: Flags: [ TLS ]
90 # CHECK-OBJ-NEXT: - Index: 1
91 # CHECK-OBJ-NEXT: Name: custom_tls
92 # CHECK-OBJ-NEXT: Alignment: 0
93 # CHECK-OBJ-NEXT: Flags: [ TLS ]