[PATCH v2] Add __pure2 to __locale_ctype_ptr(_l)
Corinna Vinschen
vinschen@redhat.com
Tue Nov 7 16:27:00 GMT 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20171107/14f7f74a/attachment.sig>
More information about the Newlib
mailing list