Message ID | 20240527111900.1060546-3-christoph.muellner@vrull.eu |
---|---|
State | New |
Headers | show |
Series | RISC-V: Add Zbb-optimized string routines as ifuncs | expand |
On 27/05/24 08:18, Christoph Müllner wrote: > 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/memchr.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/string/memchr.c b/string/memchr.c > index 08b5c41667..a2bcd0419e 100644 > --- a/string/memchr.c > +++ b/string/memchr.c > @@ -29,6 +29,10 @@ > # define __memchr MEMCHR > #endif > > +#ifndef __CODEGEN_ATTRIBUTES > +# define __CODEGEN_ATTRIBUTES > +#endif This seems more straightforward than add a generic header, since it would overridden by each ifunc variant. I am not sure about tying the same identifier to the __always_inline macro, but it should be ok since only riscv actually uses it. > + > static __always_inline const char * > sadd (uintptr_t x, uintptr_t y) > { > @@ -36,6 +40,7 @@ sadd (uintptr_t x, uintptr_t y) > } > > /* Search no more than N bytes of S for C. */ > +__CODEGEN_ATTRIBUTES > void * > __memchr (void const *s, int c_in, size_t n) > {
diff --git a/string/memchr.c b/string/memchr.c index 08b5c41667..a2bcd0419e 100644 --- a/string/memchr.c +++ b/string/memchr.c @@ -29,6 +29,10 @@ # define __memchr MEMCHR #endif +#ifndef __CODEGEN_ATTRIBUTES +# define __CODEGEN_ATTRIBUTES +#endif + static __always_inline const char * sadd (uintptr_t x, uintptr_t y) { @@ -36,6 +40,7 @@ sadd (uintptr_t x, uintptr_t y) } /* Search no more than N bytes of S for C. */ +__CODEGEN_ATTRIBUTES void * __memchr (void const *s, int c_in, size_t n) {
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/memchr.c | 5 +++++ 1 file changed, 5 insertions(+)