[v2,05/15] string/strcmp: Add mechanism to set function attributes

Message ID 20240527111900.1060546-6-christoph.muellner@vrull.eu
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_check--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

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/strcmp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/string/strcmp.c b/string/strcmp.c
index 2bca399f52..59d7d98e5e 100644
--- a/string/strcmp.c
+++ b/string/strcmp.c
@@ -26,6 +26,11 @@ 
 # define strcmp STRCMP
 #endif
 
+#ifndef __CODEGEN_ATTRIBUTES
+# define __CODEGEN_ATTRIBUTES
+#endif
+
+__CODEGEN_ATTRIBUTES
 static inline int
 final_cmp (const op_t w1, const op_t w2)
 {
@@ -35,6 +40,7 @@  final_cmp (const op_t w1, const op_t w2)
 
 /* 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
 strcmp_aligned_loop (const op_t *x1, const op_t *x2, op_t w1)
 {
@@ -55,6 +61,7 @@  strcmp_aligned_loop (const op_t *x1, const op_t *x2, op_t w1)
    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
 strcmp_unaligned_loop (const op_t *x1, const op_t *x2, op_t w1, uintptr_t ofs)
 {
@@ -98,6 +105,7 @@  strcmp_unaligned_loop (const op_t *x1, const op_t *x2, op_t w1, uintptr_t ofs)
 /* Compare S1 and S2, returning less than, equal to or
    greater than zero if S1 is lexicographically less than,
    equal to or greater than S2.  */
+__CODEGEN_ATTRIBUTES
 int
 strcmp (const char *p1, const char *p2)
 {