PowerPC LE memcmp
commitfe6e95d7171eba5f3e07848f081676fae4e86322
authorAlan Modra <amodra@gmail.com>
Sat, 17 Aug 2013 09:16:47 +0000 (17 18:46 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 4 Oct 2013 01:10:56 +0000 (4 10:40 +0930)
treef4a262abf7061e3ab3b30ac9fa15b7a2e238b264
parent664318c3eb07032e2bfcf47cb2aa3c89280c19e7
PowerPC LE memcmp
http://sourceware.org/ml/libc-alpha/2013-08/msg00102.html

This is a rather large patch due to formatting and renaming.  The
formatting changes were to make it possible to compare power7 and
power4 versions of memcmp.  Using different register defines came
about while I was wrestling with the code, trying to find spare
registers at one stage.  I found it much simpler if we refer to a reg
by the same name throughout a function, so it's better if short-term
multiple use regs like rTMP are referred to using their register
number.  I made the cr field usage changes when attempting to reload
rWORDn regs in the exit path to byte swap before comparing when
little-endian.  That proved a bad idea due to the pipelining involved
in the main loop;  Offsets to reload the regs were different first
time around the loop..  Anyway, I left the cr field usage changes in
place for consistency.

Aside from these more-or-less cosmetic changes, I fixed a number of
places where an early exit path restores regs unnecessarily, removed
some dead code, and optimised one or two exits.

* sysdeps/powerpc/powerpc64/power7/memcmp.S: Add little-endian support.
Formatting.  Consistently use rXXX register defines or rN defines.
Use early exit labels that avoid restoring unused non-volatile regs.
Make cr field use more consistent with rWORDn compares.  Rename
regs used as shift registers for unaligned loop, using rN defines
for short lifetime/multiple use regs.
* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/memcmp.S: Likewise.  Exit with
addi 1,1,64 to pop stack frame.  Simplify return value code.
* sysdeps/powerpc/powerpc32/power4/memcmp.S: Likewise.
ChangeLog
sysdeps/powerpc/powerpc32/power4/memcmp.S
sysdeps/powerpc/powerpc32/power7/memcmp.S
sysdeps/powerpc/powerpc64/power4/memcmp.S
sysdeps/powerpc/powerpc64/power7/memcmp.S