Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/aarch64/sme-libc-memset-memchr.c
213799 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file contains basic implementations of Scalable Matrix Extension (SME)10/// compatible memset and memchr functions to be used when their assembly-11/// optimized counterparts can't.12///13//===----------------------------------------------------------------------===//1415#include <stddef.h>1617extern void *__arm_sc_memset(void *dest, int c,18size_t n) __arm_streaming_compatible {19unsigned char *destp = (unsigned char *)dest;20unsigned char c8 = (unsigned char)c;21for (size_t i = 0; i < n; ++i)22destp[i] = c8;2324return dest;25}2627extern const void *__arm_sc_memchr(const void *src, int c,28size_t n) __arm_streaming_compatible {29const unsigned char *srcp = (const unsigned char *)src;30unsigned char c8 = (unsigned char)c;31for (size_t i = 0; i < n; ++i)32if (srcp[i] == c8)33return &srcp[i];3435return NULL;36}3738