xref: /llvm-project/llvm/test/MC/WebAssembly/bulk-memory-encodings.s (revision f56b5921d3954cbd99175d0df44030e7782bc456)
1# RUN: split-file %s %t
2# RUN: llvm-mc -show-encoding -triple=wasm32-unknown-unknown -mattr=+bulk-memory < %t/wasm32.s | FileCheck %s
3# RUN: llvm-mc -show-encoding -triple=wasm64-unknown-unknown -mattr=+bulk-memory < %t/wasm64.s | FileCheck %s
4
5#--- wasm32.s
6main:
7    .functype main () -> ()
8
9    i32.const 2 # dest address
10    i32.const 3 # src offset
11    i32.const 4 # count
12    # CHECK: memory.init 3, 0 # encoding: [0xfc,0x08,0x03,0x00]
13    memory.init 3, 0
14
15    # CHECK: data.drop 3 # encoding: [0xfc,0x09,0x03]
16    data.drop 3
17
18    i32.const 2 # dst
19    i32.const 3 # src
20    i32.const 4 # count
21    # CHECK: memory.copy 0, 0 # encoding: [0xfc,0x0a,0x00,0x00]
22    memory.copy 0, 0
23
24    i32.const 2 # addr
25    i32.const 3 # val
26    i32.const 4 # count
27    # CHECK: memory.fill 0 # encoding: [0xfc,0x0b,0x00]
28    memory.fill 0
29
30    end_function
31
32#--- wasm64.s
33main:
34    .functype main () -> ()
35
36    i64.const 2 # dest address
37    i32.const 3 # src offset
38    i32.const 4 # count
39    memory.init 3, 0
40
41    data.drop 3
42
43    i64.const 2 # dst
44    i64.const 3 # src
45    i64.const 4 # count
46    memory.copy 0, 0
47
48    i64.const 2 # addr
49    i32.const 3 # val
50    i64.const 4 # count
51    memory.fill 0
52
53    end_function
54