From 9fb0cae85c1266abff645b831b7070113c89d0aa Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 11 Apr 2003 22:11:44 +0000 Subject: [PATCH] * string/test-strcmp.c (do_random_tests): Test whether return value has been promoted to wordsize if the ABI requires caller to do so. * string/test-strncmp.c (do_random_tests): Likewise. * string/test-memcmp.c (do_random_tests): Likewise. * sysdeps/powerpc/powerpc64/strcmp.S (strcmp): Sign extend rRTN before returning. --- ChangeLog | 8 ++++++++ linuxthreads/ChangeLog | 4 ++++ string/test-memcmp.c | 10 +++++++--- string/test-strcmp.c | 10 +++++++--- string/test-strncmp.c | 10 +++++++--- sysdeps/powerpc/powerpc64/strcmp.S | 5 +++++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10870c435f..aa8bd7b4ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2003-04-11 Jakub Jelinek + * string/test-strcmp.c (do_random_tests): Test whether return value + has been promoted to wordsize if the ABI requires caller to do so. + * string/test-strncmp.c (do_random_tests): Likewise. + * string/test-memcmp.c (do_random_tests): Likewise. + + * sysdeps/powerpc/powerpc64/strcmp.S (strcmp): Sign extend rRTN + before returning. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c (__fe_nomask_env): Try prctl even if __ASSUME_NEW_PRCTL_SYSCALL is not defined, but the prctl constants are. diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 9a2bb6b593..407385e734 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +2003-04-11 Martin Schwidefsky + + * sysdeps/s390/pspinlock.c (__pthread_spin_unlock): Fix asm contraints. + 2003-04-03 Ulrich Drepper * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Add diff --git a/string/test-memcmp.c b/string/test-memcmp.c index d3cc560470..4d38ddbf6a 100644 --- a/string/test-memcmp.c +++ b/string/test-memcmp.c @@ -1,5 +1,5 @@ /* Test and measure memcmp functions. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jakub Jelinek , 1999. @@ -110,7 +110,8 @@ static void do_random_tests (void) { size_t i, j, n, align1, align2, pos, len; - int result, r; + int result; + long r; unsigned char *p1 = buf1 + page_size - 512; unsigned char *p2 = buf2 + page_size - 512; @@ -159,11 +160,14 @@ do_random_tests (void) FOR_EACH_IMPL (impl, 1) { r = CALL (impl, p1 + align1, p2 + align2, len); + /* Test whether on 64-bit architectures where ABI requires + callee to promote has the promotion been done. */ + asm ("" : "=g" (r) : "0" (r)); if ((r == 0 && result) || (r < 0 && result >= 0) || (r > 0 && result <= 0)) { - error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p", + error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd) %ld != %d, p1 %p p2 %p", n, impl->name, align1, align2, len, pos, r, result, p1, p2); ret = 1; } diff --git a/string/test-strcmp.c b/string/test-strcmp.c index dbbe3a4ff6..63f14f1ce4 100644 --- a/string/test-strcmp.c +++ b/string/test-strcmp.c @@ -1,5 +1,5 @@ /* Test and measure strcmp functions. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jakub Jelinek , 1999. @@ -126,7 +126,8 @@ static void do_random_tests (void) { size_t i, j, n, align1, align2, pos, len1, len2; - int result, r; + int result; + long r; unsigned char *p1 = buf1 + page_size - 512; unsigned char *p2 = buf2 + page_size - 512; @@ -196,11 +197,14 @@ do_random_tests (void) FOR_EACH_IMPL (impl, 1) { r = CALL (impl, p1 + align1, p2 + align2); + /* Test whether on 64-bit architectures where ABI requires + callee to promote has the promotion been done. */ + asm ("" : "=g" (r) : "0" (r)); if ((r == 0 && result) || (r < 0 && result >= 0) || (r > 0 && result <= 0)) { - error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p", + error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd) %ld != %d, p1 %p p2 %p", n, impl->name, align1, align2, len1, len2, pos, r, result, p1, p2); ret = 1; } diff --git a/string/test-strncmp.c b/string/test-strncmp.c index 2c49e576d6..4fed4e50f1 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -1,5 +1,5 @@ /* Test and measure strncmp functions. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jakub Jelinek , 1999. @@ -132,7 +132,8 @@ static void do_random_tests (void) { size_t i, j, n, align1, align2, pos, len1, len2, size; - int result, r; + int result; + long r; unsigned char *p1 = buf1 + page_size - 512; unsigned char *p2 = buf2 + page_size - 512; @@ -206,11 +207,14 @@ do_random_tests (void) FOR_EACH_IMPL (impl, 1) { r = CALL (impl, p1 + align1, p2 + align2, size); + /* Test whether on 64-bit architectures where ABI requires + callee to promote has the promotion been done. */ + asm ("" : "=g" (r) : "0" (r)); if ((r == 0 && result) || (r < 0 && result >= 0) || (r > 0 && result <= 0)) { - error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p", + error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd, %zd) %ld != %d, p1 %p p2 %p", n, impl->name, align1, align2, len1, len2, pos, size, r, result, p1, p2); ret = 1; } diff --git a/sysdeps/powerpc/powerpc64/strcmp.S b/sysdeps/powerpc/powerpc64/strcmp.S index 71c6d867b7..4fb31931c6 100644 --- a/sysdeps/powerpc/powerpc64/strcmp.S +++ b/sysdeps/powerpc/powerpc64/strcmp.S @@ -85,6 +85,7 @@ L(endstring): addi rNEG, rNEG, 7 cmpw cr1, rNEG, rBITDIF sub rRTN, rWORD1, rWORD2 + extsw rRTN, rRTN bgelr+ cr1 L(equal): li rRTN, 0 @@ -97,9 +98,11 @@ L(different): extsw. rBITDIF,rBITDIF /* propagate sign for bgelr */ sub rRTN, rWORD1, rWORD2 + extsw rRTN, rRTN bgelr+ L(highbit): ori rRTN, rWORD2, 1 + extsw rRTN, rRTN /* GKM FIXME: check high bounds. */ blr @@ -124,10 +127,12 @@ L(u1): cmpwi cr1, rWORD1, 0 cmpw rWORD1, rWORD2 bne+ cr1, L(u0) L(u3): sub rRTN, rWORD1, rWORD2 + extsw rRTN, rRTN /* GKM FIXME: check high bounds. */ blr L(u4): lbz rWORD1, -1(rSTR1) sub rRTN, rWORD1, rWORD2 + extsw rRTN, rRTN /* GKM FIXME: check high bounds. */ blr END (BP_SYM (strcmp)) -- 2.43.5