//===-- Memmove implementation for aarch64 ----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H #define LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/string/memory_utils/op_builtin.h" #include "src/string/memory_utils/op_generic.h" #include "src/string/memory_utils/utils.h" #include // size_t namespace LIBC_NAMESPACE_DECL { LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) { using uint128_t = generic_v128; using uint256_t = generic_v256; using uint512_t = generic_v512; if (count == 0) return; if (count == 1) return generic::Memmove::block(dst, src); if (count <= 4) return generic::Memmove::head_tail(dst, src, count); if (count <= 8) return generic::Memmove::head_tail(dst, src, count); if (count <= 16) return generic::Memmove::head_tail(dst, src, count); if (count <= 32) return generic::Memmove::head_tail(dst, src, count); if (count <= 64) return generic::Memmove::head_tail(dst, src, count); if (count <= 128) return generic::Memmove::head_tail(dst, src, count); if (dst < src) { generic::Memmove::align_forward(dst, src, count); return generic::Memmove::loop_and_tail_forward(dst, src, count); } else { generic::Memmove::align_backward(dst, src, count); return generic::Memmove::loop_and_tail_backward(dst, src, count); } } } // namespace LIBC_NAMESPACE_DECL #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H