[PATCH] PPC optimize strncmp for PPC32/64
Paul Mackerras
paulus@samba.org
Fri Oct 24 00:04:00 GMT 2003
Steve Munroe writes:
> Currently PPC32/64 use the generic/strncmp.c implementation. This shows
> up in a recent benchmark as 25% of the total execution. The attached asm
> implementations give a 15-18% improvement over the generic code.
This looks great, but I wonder if we can do better in the unaligned
case than just falling back to the byte-by-byte comparison. I
strongly suspect that doing a word-by-word comparison with unaligned
word loads on one of the strings would be faster than the byte-by-byte
code. I suggest word-by-word (32 bit) rather than doubleword (64 bit)
because doubleword loads that are not 4-byte aligned will trap on
POWER3 (though not on POWER4).
Regards,
Paul.
More information about the Libc-alpha
mailing list