summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/emscripten/system/lib/libc/emscripten_memcpy_bulkmem.S
blob: 876b997944893e5b792b3ef810012246de829c2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifdef __wasm64__
#define PTR i64
#else
#define PTR i32
#endif

.globl _emscripten_memcpy_bulkmem
_emscripten_memcpy_bulkmem:
  .functype _emscripten_memcpy_bulkmem (PTR, PTR, PTR) -> (PTR)
  local.get 2
#ifdef __wasm64__
  i32.wrap_i64
#endif
  // memory.copy traps on OOB zero-length copies, but memcpy must not.
  if
    local.get 0
    local.get 1
    local.get 2
    memory.copy 0, 0
  end_if
  local.get 0
  end_function

.section .custom_section.target_features,"",@
.int8 1
.int8 43
.int8 11
.ascii "bulk-memory"