@@ -208,6 +208,154 @@ let encode m =
208
208
| Store ({ty = I64Type ; sz = Some Mem32 ; _} as mo ) -> op 0x3e ; memop mo
209
209
| Store {ty = F32Type | F64Type ; sz = Some _ ; _} -> assert false
210
210
211
+ | AtomicLoad ({ty = I32Type ; sz = None ; _} as mo ) ->
212
+ op 0xfe ; op 0x10 ; memop mo
213
+ | AtomicLoad ({ty = I64Type ; sz = None ; _} as mo ) ->
214
+ op 0xfe ; op 0x11 ; memop mo
215
+ | AtomicLoad ({ty = I32Type ; sz = Some Mem8 ; _} as mo ) ->
216
+ op 0xfe ; op 0x12 ; memop mo
217
+ | AtomicLoad ({ty = I32Type ; sz = Some Mem16 ; _} as mo ) ->
218
+ op 0xfe ; op 0x13 ; memop mo
219
+ | AtomicLoad {ty = I32Type ; sz = Some Mem32 ; _} -> assert false
220
+ | AtomicLoad ({ty = I64Type ; sz = Some Mem8 ; _} as mo ) ->
221
+ op 0xfe ; op 0x14 ; memop mo
222
+ | AtomicLoad ({ty = I64Type ; sz = Some Mem16 ; _} as mo ) ->
223
+ op 0xfe ; op 0x15 ; memop mo
224
+ | AtomicLoad ({ty = I64Type ; sz = Some Mem32 ; _} as mo ) ->
225
+ op 0xfe ; op 0x16 ; memop mo
226
+ | AtomicLoad {ty = F32Type | F64Type ; _} -> assert false
227
+
228
+ | AtomicStore ({ty = I32Type ; sz = None ; _} as mo ) ->
229
+ op 0xfe ; op 0x17 ; memop mo
230
+ | AtomicStore ({ty = I64Type ; sz = None ; _} as mo ) ->
231
+ op 0xfe ; op 0x18 ; memop mo
232
+ | AtomicStore ({ty = I32Type ; sz = Some Mem8 ; _} as mo ) ->
233
+ op 0xfe ; op 0x19 ; memop mo
234
+ | AtomicStore ({ty = I32Type ; sz = Some Mem16 ; _} as mo ) ->
235
+ op 0xfe ; op 0x1a ; memop mo
236
+ | AtomicStore {ty = I32Type ; sz = Some Mem32 ; _} -> assert false
237
+ | AtomicStore ({ty = I64Type ; sz = Some Mem8 ; _} as mo ) ->
238
+ op 0xfe ; op 0x1b ; memop mo
239
+ | AtomicStore ({ty = I64Type ; sz = Some Mem16 ; _} as mo ) ->
240
+ op 0xfe ; op 0x1c ; memop mo
241
+ | AtomicStore ({ty = I64Type ; sz = Some Mem32 ; _} as mo ) ->
242
+ op 0xfe ; op 0x1d ; memop mo
243
+ | AtomicStore {ty = F32Type | F64Type ; _} -> assert false
244
+
245
+ | AtomicRmw (I32 I32Op. RmwAdd, ({ty = I32Type ; sz = None ; _} as mo )) ->
246
+ op 0xfe ; op 0x1e ; memop mo
247
+ | AtomicRmw (I64 I64Op. RmwAdd, ({ty = I64Type ; sz = None ; _} as mo )) ->
248
+ op 0xfe ; op 0x1f ; memop mo
249
+ | AtomicRmw (I32 I32Op. RmwAdd, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
250
+ op 0xfe ; op 0x20 ; memop mo
251
+ | AtomicRmw (I32 I32Op. RmwAdd, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
252
+ op 0xfe ; op 0x21 ; memop mo
253
+ | AtomicRmw (I64 I64Op. RmwAdd, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
254
+ op 0xfe ; op 0x22 ; memop mo
255
+ | AtomicRmw (I64 I64Op. RmwAdd, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
256
+ op 0xfe ; op 0x23 ; memop mo
257
+ | AtomicRmw (I64 I64Op. RmwAdd, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
258
+ op 0xfe ; op 0x24 ; memop mo
259
+
260
+ | AtomicRmw (I32 I32Op. RmwSub, ({ty = I32Type ; sz = None ; _} as mo )) ->
261
+ op 0xfe ; op 0x25 ; memop mo
262
+ | AtomicRmw (I64 I64Op. RmwSub, ({ty = I64Type ; sz = None ; _} as mo )) ->
263
+ op 0xfe ; op 0x26 ; memop mo
264
+ | AtomicRmw (I32 I32Op. RmwSub, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
265
+ op 0xfe ; op 0x27 ; memop mo
266
+ | AtomicRmw (I32 I32Op. RmwSub, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
267
+ op 0xfe ; op 0x28 ; memop mo
268
+ | AtomicRmw (I64 I64Op. RmwSub, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
269
+ op 0xfe ; op 0x29 ; memop mo
270
+ | AtomicRmw (I64 I64Op. RmwSub, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
271
+ op 0xfe ; op 0x2a ; memop mo
272
+ | AtomicRmw (I64 I64Op. RmwSub, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
273
+ op 0xfe ; op 0x2b ; memop mo
274
+
275
+ | AtomicRmw (I32 I32Op. RmwAnd, ({ty = I32Type ; sz = None ; _} as mo )) ->
276
+ op 0xfe ; op 0x2c ; memop mo
277
+ | AtomicRmw (I64 I64Op. RmwAnd, ({ty = I64Type ; sz = None ; _} as mo )) ->
278
+ op 0xfe ; op 0x2d ; memop mo
279
+ | AtomicRmw (I32 I32Op. RmwAnd, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
280
+ op 0xfe ; op 0x2e ; memop mo
281
+ | AtomicRmw (I32 I32Op. RmwAnd, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
282
+ op 0xfe ; op 0x2f ; memop mo
283
+ | AtomicRmw (I64 I64Op. RmwAnd, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
284
+ op 0xfe ; op 0x30 ; memop mo
285
+ | AtomicRmw (I64 I64Op. RmwAnd, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
286
+ op 0xfe ; op 0x31 ; memop mo
287
+ | AtomicRmw (I64 I64Op. RmwAnd, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
288
+ op 0xfe ; op 0x32 ; memop mo
289
+
290
+ | AtomicRmw (I32 I32Op. RmwOr, ({ty = I32Type ; sz = None ; _} as mo )) ->
291
+ op 0xfe ; op 0x33 ; memop mo
292
+ | AtomicRmw (I64 I64Op. RmwOr, ({ty = I64Type ; sz = None ; _} as mo )) ->
293
+ op 0xfe ; op 0x34 ; memop mo
294
+ | AtomicRmw (I32 I32Op. RmwOr, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
295
+ op 0xfe ; op 0x35 ; memop mo
296
+ | AtomicRmw (I32 I32Op. RmwOr, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
297
+ op 0xfe ; op 0x36 ; memop mo
298
+ | AtomicRmw (I64 I64Op. RmwOr, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
299
+ op 0xfe ; op 0x37 ; memop mo
300
+ | AtomicRmw (I64 I64Op. RmwOr, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
301
+ op 0xfe ; op 0x38 ; memop mo
302
+ | AtomicRmw (I64 I64Op. RmwOr, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
303
+ op 0xfe ; op 0x39 ; memop mo
304
+
305
+ | AtomicRmw (I32 I32Op. RmwXor, ({ty = I32Type ; sz = None ; _} as mo )) ->
306
+ op 0xfe ; op 0x3a ; memop mo
307
+ | AtomicRmw (I64 I64Op. RmwXor, ({ty = I64Type ; sz = None ; _} as mo )) ->
308
+ op 0xfe ; op 0x3b ; memop mo
309
+ | AtomicRmw (I32 I32Op. RmwXor, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
310
+ op 0xfe ; op 0x3c ; memop mo
311
+ | AtomicRmw (I32 I32Op. RmwXor, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
312
+ op 0xfe ; op 0x3d ; memop mo
313
+ | AtomicRmw (I64 I64Op. RmwXor, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
314
+ op 0xfe ; op 0x3e ; memop mo
315
+ | AtomicRmw (I64 I64Op. RmwXor, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
316
+ op 0xfe ; op 0x3f ; memop mo
317
+ | AtomicRmw (I64 I64Op. RmwXor, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
318
+ op 0xfe ; op 0x40 ; memop mo
319
+
320
+ | AtomicRmw (I32 I32Op. RmwXchg, ({ty = I32Type ; sz = None ; _} as mo )) ->
321
+ op 0xfe ; op 0x41 ; memop mo
322
+ | AtomicRmw (I64 I64Op. RmwXchg, ({ty = I64Type ; sz = None ; _} as mo )) ->
323
+ op 0xfe ; op 0x42 ; memop mo
324
+ | AtomicRmw (I32 I32Op. RmwXchg, ({ty = I32Type ; sz = Some Mem8 ; _} as mo )) ->
325
+ op 0xfe ; op 0x43 ; memop mo
326
+ | AtomicRmw (I32 I32Op. RmwXchg, ({ty = I32Type ; sz = Some Mem16 ; _} as mo )) ->
327
+ op 0xfe ; op 0x44 ; memop mo
328
+ | AtomicRmw (I64 I64Op. RmwXchg, ({ty = I64Type ; sz = Some Mem8 ; _} as mo )) ->
329
+ op 0xfe ; op 0x45 ; memop mo
330
+ | AtomicRmw (I64 I64Op. RmwXchg, ({ty = I64Type ; sz = Some Mem16 ; _} as mo )) ->
331
+ op 0xfe ; op 0x46 ; memop mo
332
+ | AtomicRmw (I64 I64Op. RmwXchg, ({ty = I64Type ; sz = Some Mem32 ; _} as mo )) ->
333
+ op 0xfe ; op 0x47 ; memop mo
334
+
335
+ | AtomicRmw (I32 _ , {ty = I64Type ; _} ) -> assert false
336
+ | AtomicRmw (I64 _ , {ty = I32Type ; _} ) -> assert false
337
+ | AtomicRmw ((F32 _ | F64 _ ), _ ) -> assert false
338
+ | AtomicRmw (_ , {ty = I32Type ; sz = Some Mem32 ; _} ) -> assert false
339
+ | AtomicRmw (_ , {ty = F32Type | F64Type ; _} ) -> assert false
340
+
341
+ | AtomicRmwCmpXchg ({ty = I32Type ; sz = None ; _} as mo ) ->
342
+ op 0xfe ; op 0x48 ; memop mo
343
+ | AtomicRmwCmpXchg ({ty = I64Type ; sz = None ; _} as mo ) ->
344
+ op 0xfe ; op 0x49 ; memop mo
345
+ | AtomicRmwCmpXchg ({ty = I32Type ; sz = Some Mem8 ; _} as mo ) ->
346
+ op 0xfe ; op 0x4a ; memop mo
347
+ | AtomicRmwCmpXchg ({ty = I32Type ; sz = Some Mem16 ; _} as mo ) ->
348
+ op 0xfe ; op 0x4b ; memop mo
349
+ | AtomicRmwCmpXchg {ty = I32Type ; sz = Some Mem32 ; _} -> assert false
350
+ | AtomicRmwCmpXchg ({ty = I64Type ; sz = Some Mem8 ; _} as mo ) ->
351
+ op 0xfe ; op 0x4c ; memop mo
352
+ | AtomicRmwCmpXchg ({ty = I64Type ; sz = Some Mem16 ; _} as mo ) ->
353
+ op 0xfe ; op 0x4d ; memop mo
354
+ | AtomicRmwCmpXchg ({ty = I64Type ; sz = Some Mem32 ; _} as mo ) ->
355
+ op 0xfe ; op 0x4e ; memop mo
356
+ | AtomicRmwCmpXchg {ty = F32Type | F64Type ; _} -> assert false
357
+
358
+
211
359
| CurrentMemory -> op 0x3f ; u8 0x00
212
360
| GrowMemory -> op 0x40 ; u8 0x00
213
361
0 commit comments