summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arc
diff options
context:
space:
mode:
authorPavel Kozlov <pavel.kozlov@synopsys.com>2022-10-07 13:43:45 +0400
committerWaldemar Brodkorb <wbx@openadk.org>2022-10-14 09:47:02 +0200
commit663b8a0497c40a20668258bd69db13924c569c41 (patch)
treec494a97dedbfa9ae8aa72b3c7f25b05490ec8130 /libc/sysdeps/linux/arc
parentde6be7bc60f190a0d746945a3a5a143bc93a1a65 (diff)
arc: add optimized string functions for ARCv3
Add ability to use optimized versions of string functions for ARCv3 32-bit CPUs with UCLIBC_HAS_STRING_ARCH_OPT option. Add optimized memcpy/memset/memcmp code for ARCv3 CPUs based on the code from newlib and adapt for ARCv3 existed optimized strchr/strcmp/strcpy/strlen. Link to the Synopsys newlib repo with code for ARCv3 on GitHub: https://github.com/foss-for-synopsys-dwc-arc-processors/newlib Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
Diffstat (limited to 'libc/sysdeps/linux/arc')
-rw-r--r--libc/sysdeps/linux/arc/asm.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arc/asm.h b/libc/sysdeps/linux/arc/asm.h
index f15dff841..f83075ea1 100644
--- a/libc/sysdeps/linux/arc/asm.h
+++ b/libc/sysdeps/linux/arc/asm.h
@@ -7,6 +7,13 @@
#ifndef _ARC_ASM_H
#define _ARC_ASM_H
+/*
+ * Some 16-bit instructions were excluded from the ARCv3 ISA
+ * the following macros are introduced to handle these changes in one place.
+ * This will allow not to change existing ARCv2 code and use 16-bit versions
+ * of instructions for ARCv2 and replace them with 32-bit vesrions for ARCv3
+ */
+
#if defined (__ARC64_ARCH32__)
.macro PUSHR reg
@@ -25,6 +32,22 @@
pop \reg
.endm
+.macro SUBR_S dst,src1,src2
+ sub \dst, \src1, \src2
+.endm
+
+.macro ADDR_S dst,src1,src2
+ add \dst, \src1, \src2
+.endm
+
+.macro ASRR_S dst,src1,src2
+ asr \dst, \src1, \src2
+.endm
+
+.macro ASLR_S dst,src1,src2
+ asl \dst, \src1, \src2
+.endm
+
#elif defined (__ARC64_ARCH64__)
# error ARCv3 64-bit is not supported by uClibc-ng
@@ -47,6 +70,22 @@
pop_s \reg
.endm
+.macro SUBR_S dst,src1,src2
+ sub_s \dst, \src1, \src2
+.endm
+
+.macro ADDR_S dst,src1,src2
+ add_s \dst, \src1, \src2
+.endm
+
+.macro ASRR_S dst,src1,src2
+ asr_s \dst, \src1, \src2
+.endm
+
+.macro ASLR_S dst,src1,src2
+ asl_s \dst, \src1, \src2
+.endm
+
#endif
#endif /* _ARC_ASM_H */