Re: [PATCH] random: vDSO: Avoid call to memset() when zeroing reserved in __cvdso_getrandom_data()
From: Nick Desaulniers
Date: Wed Sep 16 2026 - 19:45:26 EST
On Wed, Sep 16, 2026 at 3:57 PM Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
>
> > Any idea why we only see this for riscv? Would think loop idiom
> > recognition would make this transform for any target.
>
> I have not confirmed this but based on looking at the aarch64
> disassembly when deciding how to tackle this, I suspect some backends
> can expand certain calls to memset() to a set of instructions, as I saw
> a set of stp calls with xzr as the source and offsets into params as the
> dest.
https://godbolt.org/z/dbPrexfvo
Yeah, just seems like there's a heuristic/threshold for the trip
count. (GCC will also generate the libcall for trip counts >= 16).
--
Thanks,
~Nick Desaulniers