1 //===-- Memcpy implementation for aarch64 -----------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 #ifndef LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_MEMCPY_IMPLEMENTATIONS_H
9 #define LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_MEMCPY_IMPLEMENTATIONS_H
11 #include "src/__support/macros/config.h" // LIBC_INLINE
12 #include "src/string/memory_utils/op_builtin.h"
13 #include "src/string/memory_utils/utils.h"
15 #include <stddef.h> // size_t
17 namespace __llvm_libc
{
19 [[maybe_unused
]] LIBC_INLINE
void
20 inline_memcpy_aarch64(Ptr __restrict dst
, CPtr __restrict src
, size_t count
) {
24 return builtin::Memcpy
<1>::block(dst
, src
);
26 return builtin::Memcpy
<2>::block(dst
, src
);
28 return builtin::Memcpy
<3>::block(dst
, src
);
30 return builtin::Memcpy
<4>::block(dst
, src
);
32 return builtin::Memcpy
<4>::head_tail(dst
, src
, count
);
34 return builtin::Memcpy
<8>::head_tail(dst
, src
, count
);
36 return builtin::Memcpy
<16>::head_tail(dst
, src
, count
);
38 return builtin::Memcpy
<32>::head_tail(dst
, src
, count
);
40 return builtin::Memcpy
<64>::head_tail(dst
, src
, count
);
41 builtin::Memcpy
<16>::block(dst
, src
);
42 align_to_next_boundary
<16, Arg::Src
>(dst
, src
, count
);
43 return builtin::Memcpy
<64>::loop_and_tail(dst
, src
, count
);
46 } // namespace __llvm_libc
48 #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_MEMCPY_IMPLEMENTATIONS_H