1 # RUN: llvm-mc -triple=wasm64-unknown-unknown -mattr=+atomics,+simd128,+nontrapping-fptoint,+exception-handling < %s | FileCheck %s
2 # RUN: llvm-mc -triple=wasm64-unknown-unknown -filetype=obj -mattr=+atomics,+simd128,+nontrapping-fptoint,+exception-handling -o - < %s | obj2yaml | FileCheck %s -check-prefix=BIN
4 # Most of our other tests are for wasm32, this one adds some wasm64 specific tests.
6 .globaltype myglob64, i64
7 .globaltype __stack_pointer, i64
10 .functype test (i64) -> ()
15 i64.const
0 # get i64 from constant.
19 local.get
0 # get i64 from local.
23 i64.const
.L.str # get i64 relocatable.
27 global.get myglob64
# get i64 from global
32 f32.load
.L.str # relocatable offset!
37 i64.const
0 # get i64 from constant.
41 local.get
0 # get i64 from local.
45 i64.const
.L.str # get i64 relocatable.
49 global.get myglob64
# get i64 from global
55 f32.store
.L.str # relocatable offset!
59 global.get __stack_pointer
64 .section .rodata..L.str,"",@
68 .asciz "Hello, World!!!"
69 .int64 .L.str # relocatable inside data.
73 # CHECK: .globaltype myglob64, i64
75 # CHECK: .functype test (i64) -> ()
76 # CHECK-NEXT: .local i64
80 # CHECK-NEXT: f32.load 0
84 # CHECK-NEXT: f32.load 0
87 # CHECK: i64.const .L.str
88 # CHECK-NEXT: f32.load 0
91 # CHECK: global.get myglob64
92 # CHECK-NEXT: f32.load 0
96 # CHECK-NEXT: f32.load .L.str
101 # CHECK-NEXT: f32.const 0x0p0
102 # CHECK-NEXT: f32.store 0
105 # CHECK-NEXT: f32.const 0x0p0
106 # CHECK-NEXT: f32.store 0
108 # CHECK: i64.const .L.str
109 # CHECK-NEXT: f32.const 0x0p0
110 # CHECK-NEXT: f32.store 0
112 # CHECK: global.get myglob64
113 # CHECK-NEXT: f32.const 0x0p0
114 # CHECK-NEXT: f32.store 0
117 # CHECK-NEXT: f32.const 0x0p0
118 # CHECK-NEXT: f32.store .L.str
121 # CHECK: end_function
123 # CHECK: .section .rodata..L.str,"",@
124 # CHECK-NEXT: .hidden .L.str
125 # CHECK-NEXT: .L.str:
126 # CHECK-NEXT: .asciz "Hello, World!!!"
127 # CHECK-NEXT: .int64 .L.str
128 # CHECK-NEXT: .size .L.str, 24
133 # BIN-NEXT: FileHeader:
134 # BIN-NEXT: Version: 0x1
135 # BIN-NEXT: Sections:
136 # BIN-NEXT: - Type: TYPE
137 # BIN-NEXT: Signatures:
138 # BIN-NEXT: - Index: 0
139 # BIN-NEXT: ParamTypes:
141 # BIN-NEXT: ReturnTypes: []
142 # BIN-NEXT: - Type: IMPORT
144 # BIN-NEXT: - Module: env
145 # BIN-NEXT: Field: __linear_memory
146 # BIN-NEXT: Kind: MEMORY
148 # BIN-NEXT: Flags: [ IS_64 ]
149 # BIN-NEXT: Minimum: 0x1
150 # BIN-NEXT: - Module: env
151 # BIN-NEXT: Field: myglob64
152 # BIN-NEXT: Kind: GLOBAL
153 # BIN-NEXT: GlobalType: I64
154 # BIN-NEXT: GlobalMutable: true
155 # BIN-NEXT: - Module: env
156 # BIN-NEXT: Field: __stack_pointer
157 # BIN-NEXT: Kind: GLOBAL
158 # BIN-NEXT: GlobalType: I64
159 # BIN-NEXT: GlobalMutable: true
160 # BIN-NEXT: - Type: FUNCTION
161 # BIN-NEXT: FunctionTypes: [ 0 ]
162 # BIN-NEXT: - Type: DATACOUNT
164 # BIN-NEXT: - Type: CODE
165 # BIN-NEXT: Relocations:
166 # BIN-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB64
168 # BIN-NEXT: Offset: 0x13
169 # BIN-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
171 # BIN-NEXT: Offset: 0x22
172 # BIN-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB64
174 # BIN-NEXT: Offset: 0x2F
175 # BIN-NEXT: - Type: R_WASM_MEMORY_ADDR_SLEB64
177 # BIN-NEXT: Offset: 0x4F
178 # BIN-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
180 # BIN-NEXT: Offset: 0x62
181 # BIN-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB64
183 # BIN-NEXT: Offset: 0x78
184 # BIN-NEXT: - Type: R_WASM_GLOBAL_INDEX_LEB
186 # BIN-NEXT: Offset: 0x83
187 # BIN-NEXT: Functions:
188 # BIN-NEXT: - Index: 0
190 # BIN-NEXT: - Type: I64
192 # BIN-NEXT: Body: 42002A02001A20002A02001A42808080808080808080002A02001A2380808080002A02001A42002A02808080808080808080001A4200430000000038020020004300000000380200428080808080808080800043000000003802002380808080004300000000380200420043000000003802808080808080808080002381808080001A0B
193 # BIN-NEXT: - Type: DATA
194 # BIN-NEXT: Relocations:
195 # BIN-NEXT: - Type: R_WASM_MEMORY_ADDR_I64
197 # BIN-NEXT: Offset: 0x16
198 # BIN-NEXT: Segments:
199 # BIN-NEXT: - SectionOffset: 6
200 # BIN-NEXT: InitFlags: 0
202 # BIN-NEXT: Opcode: I64_CONST
204 # BIN-NEXT: Content: 48656C6C6F2C20576F726C64212121000000000000000000
205 # BIN-NEXT: - Type: CUSTOM
206 # BIN-NEXT: Name: linking
207 # BIN-NEXT: Version: 2
208 # BIN-NEXT: SymbolTable:
209 # BIN-NEXT: - Index: 0
210 # BIN-NEXT: Kind: FUNCTION
211 # BIN-NEXT: Name: test
212 # BIN-NEXT: Flags: [ BINDING_LOCAL ]
213 # BIN-NEXT: Function: 0
214 # BIN-NEXT: - Index: 1
215 # BIN-NEXT: Kind: DATA
216 # BIN-NEXT: Name: .L.str
217 # BIN-NEXT: Flags: [ BINDING_LOCAL, VISIBILITY_HIDDEN ]
218 # BIN-NEXT: Segment: 0
220 # BIN-NEXT: - Index: 2
221 # BIN-NEXT: Kind: GLOBAL
222 # BIN-NEXT: Name: myglob64
223 # BIN-NEXT: Flags: [ UNDEFINED ]
224 # BIN-NEXT: Global: 0
225 # BIN-NEXT: - Index: 3
226 # BIN-NEXT: Kind: GLOBAL
227 # BIN-NEXT: Name: __stack_pointer
228 # BIN-NEXT: Flags: [ UNDEFINED ]
229 # BIN-NEXT: Global: 1
230 # BIN-NEXT: SegmentInfo:
231 # BIN-NEXT: - Index: 0
232 # BIN-NEXT: Name: .rodata..L.str
233 # BIN-NEXT: Alignment: 0
234 # BIN-NEXT: Flags: [ ]