Skip to content

Commit 90d4f6a

Browse files
committed
[compiler-rt] Support aarch64 targets without FPU
Fall back to the old C implementation of __arm_sc_memset when the target doesn't have an FPU. Signed-off-by: Keith Packard <[email protected]>
1 parent 7002f22 commit 90d4f6a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
#include "../assembly.h"
88

9-
#ifdef __aarch64__
10-
119
#define L(l) .L ## l
1210

1311
//
@@ -238,7 +236,8 @@ END_COMPILERRT_OUTLINE_FUNCTION(__arm_sc_memcpy)
238236

239237
DEFINE_COMPILERRT_FUNCTION_ALIAS(__arm_sc_memmove, __arm_sc_memcpy)
240238

241-
239+
// This version uses FP registers. Use this only on targets with them
240+
#if defined(__aarch64__) && __ARM_FP != 0
242241
//
243242
// __arm_sc_memset
244243
//

compiler-rt/lib/builtins/aarch64/sme-libc-routines.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#include <stddef.h>
22

3+
/* The asm version uses FP registers. Use this on targets without them */
4+
#if __ARM_FP == 0
5+
void *__arm_sc_memset(void *dest, int c, size_t n) __arm_streaming_compatible {
6+
unsigned char *destp = (unsigned char *)dest;
7+
unsigned char c8 = (unsigned char)c;
8+
for (size_t i = 0; i < n; ++i)
9+
destp[i] = c8;
10+
11+
return dest;
12+
}
13+
#endif
14+
315
const void *__arm_sc_memchr(const void *src, int c,
416
size_t n) __arm_streaming_compatible {
517
const unsigned char *srcp = (const unsigned char *)src;

0 commit comments

Comments
 (0)