[v2,07/15] string/strncmp: Add mechanism to set function attributes

Message ID 20240527111900.1060546-8-christoph.muellner@vrull.eu (mailing list archive)
State New
Headers
Series RISC-V: Add Zbb-optimized string routines as ifuncs |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed

Commit Message

Christoph Müllner May 27, 2024, 11:18 a.m. UTC
  This patch introduces the __CODEGEN_ATTRIBUTES macro which can be
used to set function attributes when building the code.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 string/strncmp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/string/strncmp.c b/string/strncmp.c
index 67cc97542a..13c656dc2e 100644
--- a/string/strncmp.c
+++ b/string/strncmp.c
@@ -29,6 +29,11 @@ 
 #define STRNCMP strncmp
 #endif
 
+#ifndef __CODEGEN_ATTRIBUTES
+# define __CODEGEN_ATTRIBUTES
+#endif
+
+__CODEGEN_ATTRIBUTES
 static inline int
 final_cmp (const op_t w1, const op_t w2, size_t n)
 {
@@ -40,6 +45,7 @@  final_cmp (const op_t w1, const op_t w2, size_t n)
 
 /* Aligned loop: if a difference is found, exit to compare the bytes.  Else
    if a zero is found we have equal strings.  */
+__CODEGEN_ATTRIBUTES
 static inline int
 strncmp_aligned_loop (const op_t *x1, const op_t *x2, op_t w1, size_t n)
 {
@@ -64,6 +70,7 @@  strncmp_aligned_loop (const op_t *x1, const op_t *x2, op_t w1, size_t n)
    the bytes so that we can also apply the has_zero test to see if we have
    already reached EOS.  If we have, then we can simply fall through to the
    final comparison.  */
+__CODEGEN_ATTRIBUTES
 static inline int
 strncmp_unaligned_loop (const op_t *x1, const op_t *x2, op_t w1, uintptr_t ofs,
 			size_t n)
@@ -110,6 +117,7 @@  strncmp_unaligned_loop (const op_t *x1, const op_t *x2, op_t w1, uintptr_t ofs,
    returning less than, equal to or greater than zero
    if S1 is lexicographically less than, equal to or
    greater than S2.  */
+__CODEGEN_ATTRIBUTES
 int
 STRNCMP (const char *p1, const char *p2, size_t n)
 {