[PATCH v1 3/3] riscv: Enable RVV strcpy in both ifunc-impl-list and resolver

Jeff Law jlaw@ventanamicro.com
Fri Sep 19 02:39:20 GMT 2025


On 9/18/25 18:50, Yao Zihong wrote:
> This patch wires up the RVV implementation and enables runtime selection
> on both sides.
> 
> - Add __strcpy_vector to ifunc-impl-list.c, guarded by hwprobe result
>    of the V extension.
> - Extend select_strcpy_ifunc in strcpy.c to also check dl_hwcap and
>    return __strcpy_vector when COMPAT_HWCAP_ISA_V is present.
> - Keep __strcpy_generic as the fallback for systems without V.
> 
> Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>

>   
>   static inline __typeof (__redirect_strcpy) *
>   select_strcpy_ifunc (uint64_t dl_hwcap, __riscv_hwprobe_t hwprobe_func)
>   {
> +  if (dl_hwcap & COMPAT_HWCAP_ISA_V)
> +    return __strcpy_vector;
>     return __strcpy_generic;
>   }
Is pulling this data out of dl_hwcap really the right way to go?  Ours 
does the hwprobe call in the resolver and given the resolver runs just 
once, so it's not really a performance concern.

I don't mind using hwcaps if the rest of the glibc maintainers think 
it's correct, I'm just pointing out it is different than the 
implementation we've been using:

> +  if (__riscv_hwprobe_one (hwprobe_func, RISCV_HWPROBE_KEY_BASE_BEHAVIOR, &v) == 0
> +      && (v & RISCV_HWPROBE_IMA_V) == RISCV_HWPROBE_IMA_V)
> +    return __strcpy_vector;

Thanks!

Jeff



More information about the Libc-alpha mailing list