Why set zero in zero.c rather than use xor_n
Marc Glisse
marc.glisse at inria.fr
Mon Feb 5 20:53:06 UTC 2018
On Mon, 5 Feb 2018, Niels Möller wrote:
>> I am not sure it is important enough to write in asm, though.
>
> Probably not. But it might make sense to rewrite as a wrapper for
> memset, which I'd expect to be well optimized in gcc and libc.
If you compile the current zero.c with -O3, gcc generates a call to memset
(protected by a test). If that's what we are getting, we might as well
write it this way and make the function inline.
Supposedly, for small sizes, mpn_zero can have a smaller overhead than
memset, since it has more alignment information. But I don't think I've
ever used mpn_zero...
--
Marc Glisse
More information about the gmp-devel
mailing list