1 //===-- Memcmp implementation for riscv -------------------------*- 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_RISCV_INLINE_MEMCMP_H
9 #define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H
11 #include "src/__support/macros/attributes.h" // LIBC_INLINE
12 #include "src/__support/macros/config.h"
13 #include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
14 #include "src/string/memory_utils/generic/aligned_access.h"
15 #include "src/string/memory_utils/utils.h" // Ptr, CPtr
17 #include <stddef.h> // size_t
19 namespace LIBC_NAMESPACE_DECL
{
21 [[maybe_unused
]] LIBC_INLINE MemcmpReturnType
22 inline_memcmp_riscv(CPtr p1
, CPtr p2
, size_t count
) {
23 #if defined(LIBC_TARGET_ARCH_IS_RISCV64)
24 return inline_memcmp_aligned_access_64bit(p1
, p2
, count
);
25 #elif defined(LIBC_TARGET_ARCH_IS_RISCV32)
26 return inline_memcmp_aligned_access_32bit(p1
, p2
, count
);
28 #error "Unimplemented"
32 } // namespace LIBC_NAMESPACE_DECL
34 #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H