[PATCH] elf: Replace memcmp with __memcmpeq for variable size
H.J. Lu
hjl.tools@gmail.com
Mon Feb 7 14:00:50 GMT 2022
On Mon, Feb 7, 2022 at 5:30 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 07/02/2022 10:27, H.J. Lu via Libc-alpha wrote:
> > On Mon, Feb 7, 2022 at 5:19 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu:
> >>
> >>>> This must be something else. According to the numbers, we save ~159
> >>>> between ~569 cycles per __memcmpeq call. That is just not realistic.
> >>>
> >>> I removed the cycle info from the commit log.
> >>
> >> If we can't show the change is beneficial, is it worth the additional
> >> 1000 or so bytes in the loader text?
> >>
> >
> > $ LD_DEBUG=statistics elf/tst-relsort1 --direct
> >
> > does show improvements when __memcmpeq is called 24 times.
> > But the cycle number changes for each run. The overall trend is
> > faster. It will be more obvious when memcmp is called more often.
> >
>
> My understanding is this optimization would eventually be implemented by
What kinds of codes should compilers generate? For glibc internal
usage, we can write codes in such a way that the generated codes
are very similar to what compilers should generate.
> the compiler, so maybe it would be better to let it optimize if suitable
> (similar to what we are aiming for math code).
--
H.J.
More information about the Libc-alpha
mailing list