diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-11-17 21:19:33 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-11-17 21:19:33 +0000 |
commit | 8ce9ea74cc2a6ce6fdafac0e0829b1bc93788143 (patch) | |
tree | 0ff362f555105a0d52a00c358bf192d20d6e9141 /sysdeps | |
parent | 52d979bb0d55911b4f60ae87588bede557082aaa (diff) | |
download | glibc-8ce9ea74cc2a6ce6fdafac0e0829b1bc93788143.tar.gz glibc-8ce9ea74cc2a6ce6fdafac0e0829b1bc93788143.tar.xz glibc-8ce9ea74cc2a6ce6fdafac0e0829b1bc93788143.zip |
[BZ #1877]
2005-11-17 Steven Munroe <sjmunroe@us.ibm.com> [BZ #1877] * string/test-strncmp.c (do_test_limit): New function. (do_test) Add cast to eliminate compiler warnings. (do_random_tests) Add cast to eliminate compiler warnings. (test_main) Add do_test_limit tests. * sysdeps/powerpc/powerpc32/strncmp.S: Test length before unaligned load. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/powerpc/powerpc32/strncmp.S | 17 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/strncmp.S | 17 |
2 files changed, 22 insertions, 12 deletions
diff --git a/sysdeps/powerpc/powerpc32/strncmp.S b/sysdeps/powerpc/powerpc32/strncmp.S index 3b33bb921f..3e0fff5ac2 100644 --- a/sysdeps/powerpc/powerpc32/strncmp.S +++ b/sysdeps/powerpc/powerpc32/strncmp.S @@ -47,6 +47,7 @@ EALIGN (BP_SYM(strncmp), 4, 0) lis r7F7F, 0x7f7f dcbt 0,rSTR2 clrlwi. rTMP, rTMP, 30 + cmplwi cr1, rN, 0 lis rFEFE, -0x101 bne L(unaligned) /* We are word alligned so set up for two loops. first a word @@ -54,7 +55,8 @@ EALIGN (BP_SYM(strncmp), 4, 0) srwi. rTMP, rN, 2 clrlwi rN, rN, 30 addi rFEFE, rFEFE, -0x101 - addi r7F7F, r7F7F, 0x7f7f + addi r7F7F, r7F7F, 0x7f7f + cmplwi cr1, rN, 0 beq L(unaligned) mtctr rTMP /* Power4 wants mtctr 1st in dispatch group. */ @@ -122,16 +124,19 @@ L(tail): addi rSTR1, rSTR1, 4 bne- cr1, L(different) addi rSTR2, rSTR2, 4 + cmplwi cr1, rN, 0 L(unaligned): mtctr rN /* Power4 wants mtctr 1st in dispatch group */ - cmpwi rN,0 - lbz rWORD1, 0(rSTR1) - lbz rWORD2, 0(rSTR2) - bgt L(u1) + bgt cr1, L(uz) L(ux): li rRTN, 0 blr - + .align 4 +L(uz): + lbz rWORD1, 0(rSTR1) + lbz rWORD2, 0(rSTR2) + nop + b L(u1) L(u0): lbzu rWORD2, 1(rSTR2) L(u1): diff --git a/sysdeps/powerpc/powerpc64/strncmp.S b/sysdeps/powerpc/powerpc64/strncmp.S index 04bdc2f606..34479e2e91 100644 --- a/sysdeps/powerpc/powerpc64/strncmp.S +++ b/sysdeps/powerpc/powerpc64/strncmp.S @@ -48,6 +48,7 @@ EALIGN (BP_SYM(strncmp), 4, 0) lis r7F7F, 0x7f7f dcbt 0,rSTR2 clrldi. rTMP, rTMP, 61 + cmpldi cr1, rN, 0 lis rFEFE, -0x101 bne L(unaligned) /* We are doubleword alligned so set up for two loops. first a double word @@ -55,7 +56,8 @@ EALIGN (BP_SYM(strncmp), 4, 0) srdi. rTMP, rN, 3 clrldi rN, rN, 61 addi rFEFE, rFEFE, -0x101 - addi r7F7F, r7F7F, 0x7f7f + addi r7F7F, r7F7F, 0x7f7f + cmpldi cr1, rN, 0 beq L(unaligned) mtctr rTMP /* Power4 wants mtctr 1st in dispatch group. */ @@ -126,16 +128,19 @@ L(tail): addi rSTR1, rSTR1, 8 bne- cr1, L(different) addi rSTR2, rSTR2, 8 + cmpldi cr1, rN, 0 L(unaligned): mtctr rN /* Power4 wants mtctr 1st in dispatch group */ - cmpdi rN,0 - lbz rWORD1, 0(rSTR1) - lbz rWORD2, 0(rSTR2) - bgt L(u1) + bgt cr1, L(uz) L(ux): li rRTN, 0 blr - + .align 4 +L(uz): + lbz rWORD1, 0(rSTR1) + lbz rWORD2, 0(rSTR2) + nop + b L(u1) L(u0): lbzu rWORD2, 1(rSTR2) L(u1): |