This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Add __pure2 to __locale_ctype_ptr(_l)


Corinna Vinschen wrote: 
On Nov  6 18:40, Wilco Dijkstra wrote:

> I tried again on an x86_64 system running gcc 6.4.0, with -O2, -O3, with
> the original while as well as a for loop, with and without __pure2, and
> I don't see any difference whatsoever.

Did you check the call to __locale_ctype_ptr is lifted out of the loop in the
optimized case? It seems you might just be benchmarking the original version.
Even GCC4.8 optimizes a slightly modified version of your loop with -O3:

    for (p = &arr[0]; c = *p++; )
    {
      a = ispunct (c);
      if (a)
        printf ("holla\n");
    }

And it works with -O2 if you split off the p++ in the increment part of the for.

> So it seems this is very much architecture dependent.  We can surely add
> __pure2 if it makes a difference on some platforms.

No this is certainly not architecture dependent. The ctype implementation used to
be fast, but it is slow now - changes made to ctype last year caused it.

Wilco

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]