diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-11-17 11:13:22 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-11-17 12:04:25 +0000 |
commit | 67a49eeffa7bd4d90a4edf54cb9d4d784ab170a7 (patch) | |
tree | 097d17b3865c6a2fea61ef64b98338a80869b7ff /string | |
parent | 8e0a666f7840c745fcb9fe9d977a95c3d13ae246 (diff) | |
download | arm-optimized-routines-67a49eeffa7bd4d90a4edf54cb9d4d784ab170a7.tar.gz |
string: Add separate asmdefs.h per target
The definitions in this header are necessarily target specific, so
better to have a separate version in each target directory.
Diffstat (limited to 'string')
39 files changed, 122 insertions, 115 deletions
diff --git a/string/aarch64/__mtag_tag_region.S b/string/aarch64/__mtag_tag_region.S index 84b8c94..d9b7b64 100644 --- a/string/aarch64/__mtag_tag_region.S +++ b/string/aarch64/__mtag_tag_region.S @@ -15,7 +15,7 @@ * The memory region may remain untagged if tagging is not enabled. */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_MEMORY_TAGGING diff --git a/string/aarch64/__mtag_tag_zero_region.S b/string/aarch64/__mtag_tag_zero_region.S index 97ae68e..874acf5 100644 --- a/string/aarch64/__mtag_tag_zero_region.S +++ b/string/aarch64/__mtag_tag_zero_region.S @@ -15,7 +15,7 @@ * The memory region may remain untagged if tagging is not enabled. */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_MEMORY_TAGGING diff --git a/string/aarch64/asmdefs.h b/string/aarch64/asmdefs.h new file mode 100644 index 0000000..b5ad6fb --- /dev/null +++ b/string/aarch64/asmdefs.h @@ -0,0 +1,83 @@ +/* + * Macros for asm code. AArch64 version. + * + * Copyright (c) 2019-2022, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception + */ + +#ifndef _ASMDEFS_H +#define _ASMDEFS_H + +/* Branch Target Identitication support. */ +#define BTI_C hint 34 +#define BTI_J hint 36 +/* Return address signing support (pac-ret). */ +#define PACIASP hint 25; .cfi_window_save +#define AUTIASP hint 29; .cfi_window_save + +/* GNU_PROPERTY_AARCH64_* macros from elf.h. */ +#define FEATURE_1_AND 0xc0000000 +#define FEATURE_1_BTI 1 +#define FEATURE_1_PAC 2 + +/* Add a NT_GNU_PROPERTY_TYPE_0 note. */ +#define GNU_PROPERTY(type, value) \ + .section .note.gnu.property, "a"; \ + .p2align 3; \ + .word 4; \ + .word 16; \ + .word 5; \ + .asciz "GNU"; \ + .word type; \ + .word 4; \ + .word value; \ + .word 0; \ + .text + +/* If set then the GNU Property Note section will be added to + mark objects to support BTI and PAC-RET. */ +#ifndef WANT_GNU_PROPERTY +#define WANT_GNU_PROPERTY 1 +#endif + +#if WANT_GNU_PROPERTY +/* Add property note with supported features to all asm files. */ +GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) +#endif + +#define ENTRY_ALIGN(name, alignment) \ + .global name; \ + .type name,%function; \ + .align alignment; \ + name: \ + .cfi_startproc; \ + BTI_C; + +#define ENTRY(name) ENTRY_ALIGN(name, 6) + +#define ENTRY_ALIAS(name) \ + .global name; \ + .type name,%function; \ + name: + +#define END(name) \ + .cfi_endproc; \ + .size name, .-name; + +#define L(l) .L ## l + +#ifdef __ILP32__ + /* Sanitize padding bits of pointer arguments as per aapcs64 */ +#define PTR_ARG(n) mov w##n, w##n +#else +#define PTR_ARG(n) +#endif + +#ifdef __ILP32__ + /* Sanitize padding bits of size arguments as per aapcs64 */ +#define SIZE_ARG(n) mov w##n, w##n +#else +#define SIZE_ARG(n) +#endif + +#endif diff --git a/string/aarch64/check-arch.S b/string/aarch64/check-arch.S index 1565465..58f92d9 100644 --- a/string/aarch64/check-arch.S +++ b/string/aarch64/check-arch.S @@ -10,4 +10,4 @@ #endif /* Include for GNU property notes. */ -#include "../asmdefs.h" +#include "asmdefs.h" diff --git a/string/aarch64/memchr-mte.S b/string/aarch64/memchr-mte.S index d4673b3..a2870d3 100644 --- a/string/aarch64/memchr-mte.S +++ b/string/aarch64/memchr-mte.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define chrin w1 diff --git a/string/aarch64/memchr-sve.S b/string/aarch64/memchr-sve.S index 820228e..3b358b1 100644 --- a/string/aarch64/memchr-sve.S +++ b/string/aarch64/memchr-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/memchr.S b/string/aarch64/memchr.S index 5879c1c..53eadf7 100644 --- a/string/aarch64/memchr.S +++ b/string/aarch64/memchr.S @@ -11,7 +11,7 @@ * Neon Available. */ -#include "../asmdefs.h" +#include "asmdefs.h" /* Arguments and results. */ #define srcin x0 diff --git a/string/aarch64/memcmp-sve.S b/string/aarch64/memcmp-sve.S index d29588c..22e6d2c 100644 --- a/string/aarch64/memcmp-sve.S +++ b/string/aarch64/memcmp-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/memcmp.S b/string/aarch64/memcmp.S index e19521f..aa180e8 100644 --- a/string/aarch64/memcmp.S +++ b/string/aarch64/memcmp.S @@ -9,7 +9,7 @@ * ARMv8-a, AArch64, Advanced SIMD, unaligned accesses. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define src1 x0 #define src2 x1 diff --git a/string/aarch64/memcpy-advsimd.S b/string/aarch64/memcpy-advsimd.S index d1368d0..e86d7a3 100644 --- a/string/aarch64/memcpy-advsimd.S +++ b/string/aarch64/memcpy-advsimd.S @@ -11,7 +11,7 @@ * */ -#include "../asmdefs.h" +#include "asmdefs.h" #define dstin x0 #define src x1 diff --git a/string/aarch64/memcpy-sve.S b/string/aarch64/memcpy-sve.S index 66ae896..b82510a 100644 --- a/string/aarch64/memcpy-sve.S +++ b/string/aarch64/memcpy-sve.S @@ -13,7 +13,7 @@ #if __ARM_FEATURE_SVE -#include "../asmdefs.h" +#include "asmdefs.h" #define dstin x0 #define src x1 diff --git a/string/aarch64/memcpy.S b/string/aarch64/memcpy.S index 36aaf60..2415bd6 100644 --- a/string/aarch64/memcpy.S +++ b/string/aarch64/memcpy.S @@ -11,7 +11,7 @@ * */ -#include "../asmdefs.h" +#include "asmdefs.h" #define dstin x0 #define src x1 diff --git a/string/aarch64/memrchr.S b/string/aarch64/memrchr.S index 4726618..bee71ef 100644 --- a/string/aarch64/memrchr.S +++ b/string/aarch64/memrchr.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define chrin w1 diff --git a/string/aarch64/memset.S b/string/aarch64/memset.S index ad0b0d6..6bbcedf 100644 --- a/string/aarch64/memset.S +++ b/string/aarch64/memset.S @@ -11,7 +11,7 @@ * */ -#include "../asmdefs.h" +#include "asmdefs.h" #define dstin x0 #define val x1 diff --git a/string/aarch64/strchr-mte.S b/string/aarch64/strchr-mte.S index 8840f0d..04f269f 100644 --- a/string/aarch64/strchr-mte.S +++ b/string/aarch64/strchr-mte.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define chrin w1 diff --git a/string/aarch64/strchr-sve.S b/string/aarch64/strchr-sve.S index 1b984b9..e18640c 100644 --- a/string/aarch64/strchr-sve.S +++ b/string/aarch64/strchr-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strchr.S b/string/aarch64/strchr.S index 3aab56c..a041e57 100644 --- a/string/aarch64/strchr.S +++ b/string/aarch64/strchr.S @@ -11,7 +11,7 @@ * Neon Available. */ -#include "../asmdefs.h" +#include "asmdefs.h" /* Arguments and results. */ #define srcin x0 diff --git a/string/aarch64/strchrnul-mte.S b/string/aarch64/strchrnul-mte.S index b1ac4db..cd67858 100644 --- a/string/aarch64/strchrnul-mte.S +++ b/string/aarch64/strchrnul-mte.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define chrin w1 diff --git a/string/aarch64/strchrnul.S b/string/aarch64/strchrnul.S index dc57f5f..c6b295d 100644 --- a/string/aarch64/strchrnul.S +++ b/string/aarch64/strchrnul.S @@ -11,7 +11,7 @@ * Neon Available. */ -#include "../asmdefs.h" +#include "asmdefs.h" /* Arguments and results. */ #define srcin x0 diff --git a/string/aarch64/strcmp-sve.S b/string/aarch64/strcmp-sve.S index 6ce80e3..4c00463 100644 --- a/string/aarch64/strcmp-sve.S +++ b/string/aarch64/strcmp-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strcmp.S b/string/aarch64/strcmp.S index bc1f74e..137a9aa 100644 --- a/string/aarch64/strcmp.S +++ b/string/aarch64/strcmp.S @@ -12,7 +12,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define REP8_01 0x0101010101010101 #define REP8_7f 0x7f7f7f7f7f7f7f7f diff --git a/string/aarch64/strcpy-sve.S b/string/aarch64/strcpy-sve.S index 3ce951c..803e603 100644 --- a/string/aarch64/strcpy-sve.S +++ b/string/aarch64/strcpy-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strcpy.S b/string/aarch64/strcpy.S index ba4a7d8..9aca330 100644 --- a/string/aarch64/strcpy.S +++ b/string/aarch64/strcpy.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define dstin x0 #define srcin x1 diff --git a/string/aarch64/strlen-mte.S b/string/aarch64/strlen-mte.S index fdb07ae..a83b9b6 100644 --- a/string/aarch64/strlen-mte.S +++ b/string/aarch64/strlen-mte.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define result x0 diff --git a/string/aarch64/strlen-sve.S b/string/aarch64/strlen-sve.S index 0fd663f..1171558 100644 --- a/string/aarch64/strlen-sve.S +++ b/string/aarch64/strlen-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strlen.S b/string/aarch64/strlen.S index 103fac1..f164322 100644 --- a/string/aarch64/strlen.S +++ b/string/aarch64/strlen.S @@ -11,7 +11,7 @@ * Not MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define len x0 diff --git a/string/aarch64/strncmp-sve.S b/string/aarch64/strncmp-sve.S index 08b9a7e..4a7be2d 100644 --- a/string/aarch64/strncmp-sve.S +++ b/string/aarch64/strncmp-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strncmp.S b/string/aarch64/strncmp.S index 6957d07..128a10c 100644 --- a/string/aarch64/strncmp.S +++ b/string/aarch64/strncmp.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define REP8_01 0x0101010101010101 #define REP8_7f 0x7f7f7f7f7f7f7f7f diff --git a/string/aarch64/strnlen-sve.S b/string/aarch64/strnlen-sve.S index ec6f881..498a335 100644 --- a/string/aarch64/strnlen-sve.S +++ b/string/aarch64/strnlen-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strnlen.S b/string/aarch64/strnlen.S index eecfad3..03a4706 100644 --- a/string/aarch64/strnlen.S +++ b/string/aarch64/strnlen.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define cntin x1 diff --git a/string/aarch64/strrchr-mte.S b/string/aarch64/strrchr-mte.S index dcee1bf..e05579f 100644 --- a/string/aarch64/strrchr-mte.S +++ b/string/aarch64/strrchr-mte.S @@ -11,7 +11,7 @@ * MTE compatible. */ -#include "../asmdefs.h" +#include "asmdefs.h" #define srcin x0 #define chrin w1 diff --git a/string/aarch64/strrchr-sve.S b/string/aarch64/strrchr-sve.S index f907166..fbcd5ba 100644 --- a/string/aarch64/strrchr-sve.S +++ b/string/aarch64/strrchr-sve.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_FEATURE_SVE /* Assumptions: diff --git a/string/aarch64/strrchr.S b/string/aarch64/strrchr.S index a1b43ca..8f10c96 100644 --- a/string/aarch64/strrchr.S +++ b/string/aarch64/strrchr.S @@ -11,7 +11,7 @@ * Neon Available. */ -#include "../asmdefs.h" +#include "asmdefs.h" /* Arguments and results. */ #define srcin x0 diff --git a/string/asmdefs.h b/string/arm/asmdefs.h index b4e5123..a275aa6 100644 --- a/string/asmdefs.h +++ b/string/arm/asmdefs.h @@ -1,15 +1,13 @@ /* - * Macros for asm code. + * Macros for asm code. Arm version. * - * Copyright (c) 2019-2020, Arm Limited. + * Copyright (c) 2019-2022, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #ifndef _ASMDEFS_H #define _ASMDEFS_H -#if defined (__arm__) - #define ARM_FNSTART .fnstart #if defined (IS_LEAF) # define ARM_FNEND \ @@ -456,64 +454,6 @@ .endif .endm -#else /* !defined (__arm__) */ - -#define ARM_FNSTART -#define ARM_FNEND - -#endif - -#if defined(__aarch64__) - -/* Branch Target Identitication support. */ -#define BTI_C hint 34 -#define BTI_J hint 36 -/* Return address signing support (pac-ret). */ -#define PACIASP hint 25; .cfi_window_save -#define AUTIASP hint 29; .cfi_window_save - -/* GNU_PROPERTY_AARCH64_* macros from elf.h. */ -#define FEATURE_1_AND 0xc0000000 -#define FEATURE_1_BTI 1 -#define FEATURE_1_PAC 2 - -/* Add a NT_GNU_PROPERTY_TYPE_0 note. */ -#define GNU_PROPERTY(type, value) \ - .section .note.gnu.property, "a"; \ - .p2align 3; \ - .word 4; \ - .word 16; \ - .word 5; \ - .asciz "GNU"; \ - .word type; \ - .word 4; \ - .word value; \ - .word 0; \ - .text - -/* If set then the GNU Property Note section will be added to - mark objects to support BTI and PAC-RET. */ -#ifndef WANT_GNU_PROPERTY -#define WANT_GNU_PROPERTY 1 -#endif - -#if WANT_GNU_PROPERTY -/* Add property note with supported features to all asm files. */ -GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) -#endif - -#define ENTRY_ALIGN(name, alignment) \ - .global name; \ - .type name,%function; \ - .align alignment; \ - name: \ - ARM_FNSTART; \ - .cfi_startproc; \ - BTI_C; - -#else - -#define END_FILE #define ENTRY_ALIGN(name, alignment) \ .global name; \ @@ -523,8 +463,6 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) ARM_FNSTART; \ .cfi_startproc; -#endif - #define ENTRY(name) ENTRY_ALIGN(name, 6) #define ENTRY_ALIAS(name) \ @@ -539,18 +477,4 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC) #define L(l) .L ## l -#ifdef __ILP32__ - /* Sanitize padding bits of pointer arguments as per aapcs64 */ -#define PTR_ARG(n) mov w##n, w##n -#else -#define PTR_ARG(n) -#endif - -#ifdef __ILP32__ - /* Sanitize padding bits of size arguments as per aapcs64 */ -#define SIZE_ARG(n) mov w##n, w##n -#else -#define SIZE_ARG(n) -#endif - #endif diff --git a/string/arm/memchr.S b/string/arm/memchr.S index 125618d..9649e10 100644 --- a/string/arm/memchr.S +++ b/string/arm/memchr.S @@ -36,7 +36,7 @@ #define CHARTSTMASK(c) 1<<(c*8) #endif .thumb -#include "../asmdefs.h" +#include "asmdefs.h" @ --------------------------------------------------------------------------- diff --git a/string/arm/memcpy.S b/string/arm/memcpy.S index 77f4553..c4dfa8a 100644 --- a/string/arm/memcpy.S +++ b/string/arm/memcpy.S @@ -17,7 +17,7 @@ */ -#include "../asmdefs.h" +#include "asmdefs.h" .syntax unified /* This implementation requires ARM state. */ diff --git a/string/arm/strcmp-armv6m.S b/string/arm/strcmp-armv6m.S index 0e49d09..699fa1b 100644 --- a/string/arm/strcmp-armv6m.S +++ b/string/arm/strcmp-armv6m.S @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "../asmdefs.h" +#include "asmdefs.h" #if __ARM_ARCH == 6 && __ARM_ARCH_6M__ >= 1 diff --git a/string/arm/strcmp.S b/string/arm/strcmp.S index b01c02e..a69dbff 100644 --- a/string/arm/strcmp.S +++ b/string/arm/strcmp.S @@ -12,7 +12,7 @@ is sufficiently aligned. Use saturating arithmetic to optimize the compares. */ -#include "../asmdefs.h" +#include "asmdefs.h" /* Build Options: STRCMP_NO_PRECHECK: Don't run a quick pre-check of the first diff --git a/string/arm/strlen-armv6t2.S b/string/arm/strlen-armv6t2.S index f06b238..f9f50c0 100644 --- a/string/arm/strlen-armv6t2.S +++ b/string/arm/strlen-armv6t2.S @@ -13,7 +13,7 @@ */ -#include "../asmdefs.h" +#include "asmdefs.h" #ifdef __ARMEB__ #define S2LO lsl |