[PATCH v6 5/5] riscv: Add and use alignment-ignorant memcpy

Florian Weimer fweimer@redhat.com
Thu Aug 3 07:25:21 GMT 2023


* Evan Green:

> +static inline __typeof (__redirect_memcpy) *
> +select_memcpy_ifunc (uint64_t dl_hwcap, __riscv_hwprobe_t hwprobe_func)
> +{
> +  INIT_ARCH ();
> +
> +  struct riscv_hwprobe pair;
> +
> +  pair.key = RISCV_HWPROBE_KEY_CPUPERF_0;
> +  if (!hwprobe_func || hwprobe_func(&pair, 1, 0, NULL, 0) != 0)
> +    return __memcpy_generic;
> +
> +  if ((pair.key > 0) &&
> +      (pair.value & RISCV_HWPROBE_MISALIGNED_MASK) ==
> +       RISCV_HWPROBE_MISALIGNED_FAST)
> +    return __memcpy_noalignment;
> +
> +  return __memcpy_generic;
> +}

In libc, you could call __riscv_hwprobe directly, so the additional
argument isn't needed after all.

Thanks,
Florian



More information about the Libc-alpha mailing list