Proposal for Optimized Character Type Function
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Mon Mar 3 17:17:02 GMT 2025
Hi,
So if you do something like this in a loop:
sum += isupper (arr[i]);
the generated code looks as follows on AArch64:
.L5:
ldrb w1, [x2], 1
ldrh w1, [x4, x1, lsl 1]
and w1, w1, 256
add w0, w0, w1
cmp x3, x2
bne .L5
Ie. it already does exactly what you are suggesting.
A potential improvement might be to locate the ctype array faster
(perhaps at fixed TLS offset) and avoid using a function call. This would
reduce the overhead of ctype calls that aren't in tight loops.
Cheers,
Wilco
More information about the Libc-alpha
mailing list