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)


On Nov  7 16:12, Wilco Dijkstra wrote:
> Corinna Vinschen wrote: 
> > Wilco Dijkstra wrote:
> 
> > > And it works with -O2 if you split off the p++ in the increment part of the for.
> >
> > No, it doesn't.  I retried with your style of for loop, but there's
> > simply no difference for me.  -O2, -O3, pure/ not-pure, with f++ split
> > off or not, it's always taking the same time on average.
> 
> That's odd - maybe pure2 doesn't get correctly defined in your environment. I get this
> using your unchanged benchmark with -O3 - it clearly lifts the call:
> 
>         ldrb    w19, [x20]
>         add     x20, x20, 1
>         cbz     w19, .L3
>         stp     x22, x23, [sp, 40]
>         bl      __locale_ctype_ptr
>         adrp    x23, .LC0
>         mov     x22, x0
>         add     x23, x23, :lo12:.LC0
>         .p2align 3
> .L4:
>         add     x19, x22, x19, uxtb
>         ldrb    w0, [x19, 1]
>         tbnz    x0, 4, .L20
>         ldrb    w19, [x20], 1
>         cbnz    w19, .L4
> 
> What is the disassembly of your version?

The loop is the same, with and without __pure2:


.L4:
        addq    $1, %rsi
.L3:
        movsbq  (%rsi), %rbx
        testb   %bl, %bl
        je      .L23
        call    __locale_ctype_ptr
        testb   $16, 1(%rax,%rbx)
        je      .L4
        movq    %r13, %rcx
        call    puts
        jmp     .L4

And yes, I made sure __pure2 has been evaluated correctly:

  # 69 "/usr/include/ctype.h" 3 4
  const char *__locale_ctype_ptr (void) __attribute__((__const__));


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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