]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix POWER4/POWER7 optimized strncmp to not read past differing bytes
authorAndreas Schwab <schwab@linux-m68k.org>
Mon, 18 Apr 2011 02:03:53 +0000 (22:03 -0400)
committerRyan S. Arnold <rsa@us.ibm.com>
Wed, 28 Sep 2011 13:50:59 +0000 (08:50 -0500)
ChangeLog
sysdeps/powerpc/powerpc32/power4/strncmp.S
sysdeps/powerpc/powerpc32/power7/strncmp.S
sysdeps/powerpc/powerpc64/power4/strncmp.S
sysdeps/powerpc/powerpc64/power7/strncmp.S

index 9febaec114d2eec9e1dc0d755a6f733e846cb2bd..5119976d9e55be3fc6e8b76084f42d001a7d12da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-28  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
+       differing bytes.
+       * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
+       * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
+       * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
+
 2011-07-28  Will Schmidt  <will_schmidt@vnet.ibm.com>
 
        * sysdeps/powerpc/powerpc32/power7/memcpy.S: Optimize the
index fc0835ebe0f774ef73871413aeb59021b80a3bf2..f5d47af1eb4b72b8c5ae80e292cc63131ef2a0dd 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized strcmp implementation for PowerPC32.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -139,30 +139,31 @@ L(u1):
        bdz     L(u4)
        cmpw    rWORD1, rWORD2
        beq-    cr1, L(u4)
+       bne-    L(u4)
        lbzu    rWORD3, 1(rSTR1)
        lbzu    rWORD4, 1(rSTR2)
-       bne-    L(u4)
        cmpwi   cr1, rWORD3, 0
        bdz     L(u3)
        cmpw    rWORD3, rWORD4
        beq-    cr1, L(u3)
+       bne-    L(u3)
        lbzu    rWORD1, 1(rSTR1)
        lbzu    rWORD2, 1(rSTR2)
-       bne-    L(u3)
        cmpwi   cr1, rWORD1, 0
        bdz     L(u4)
        cmpw    rWORD1, rWORD2
        beq-    cr1, L(u4)
+       bne-    L(u4)
        lbzu    rWORD3, 1(rSTR1)
        lbzu    rWORD4, 1(rSTR2)
-       bne-    L(u4)
        cmpwi   cr1, rWORD3, 0
        bdz     L(u3)
        cmpw    rWORD3, rWORD4
        beq-    cr1, L(u3)
+       bne-    L(u3)
        lbzu    rWORD1, 1(rSTR1)
        lbzu    rWORD2, 1(rSTR2)
-       beq+    L(u1)
+       b       L(u1)
 
 L(u3):  sub     rRTN, rWORD3, rWORD4
         blr
index 61b33c3c36dfe3edd3fb33256bc8e02719782174..db466f07938c1cf5bc1162a6488153157c551c17 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized strcmp implementation for POWER7/PowerPC32.
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -143,30 +143,31 @@ L(u1):
        bdz     L(u4)
        cmpw    rWORD1,rWORD2
        beq     cr1,L(u4)
+       bne     L(u4)
        lbzu    rWORD3,1(rSTR1)
        lbzu    rWORD4,1(rSTR2)
-       bne     L(u4)
        cmpwi   cr1,rWORD3,0
        bdz     L(u3)
        cmpw    rWORD3,rWORD4
        beq     cr1,L(u3)
+       bne     L(u3)
        lbzu    rWORD1,1(rSTR1)
        lbzu    rWORD2,1(rSTR2)
-       bne     L(u3)
        cmpwi   cr1,rWORD1,0
        bdz     L(u4)
        cmpw    rWORD1,rWORD2
        beq     cr1,L(u4)
+       bne     L(u4)
        lbzu    rWORD3,1(rSTR1)
        lbzu    rWORD4,1(rSTR2)
-       bne     L(u4)
        cmpwi   cr1,rWORD3,0
        bdz     L(u3)
        cmpw    rWORD3,rWORD4
        beq     cr1,L(u3)
+       bne     L(u3)
        lbzu    rWORD1,1(rSTR1)
        lbzu    rWORD2,1(rSTR2)
-       beq     L(u1)
+       b       L(u1)
 
 L(u3):  sub    rRTN,rWORD3,rWORD4
        blr
index 7a1665d2bc338b518d8f911e726a5bbdca881ca8..94ae85b9e4ad6524004cd083a8b7b992e1eeaf91 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized strcmp implementation for PowerPC64.
-   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -143,30 +143,31 @@ L(u1):
        bdz     L(u4)
        cmpd    rWORD1, rWORD2
        beq-    cr1, L(u4)
+       bne-    L(u4)
        lbzu    rWORD3, 1(rSTR1)
        lbzu    rWORD4, 1(rSTR2)
-       bne-    L(u4)
        cmpdi   cr1, rWORD3, 0
        bdz     L(u3)
        cmpd    rWORD3, rWORD4
        beq-    cr1, L(u3)
+       bne-    L(u3)
        lbzu    rWORD1, 1(rSTR1)
        lbzu    rWORD2, 1(rSTR2)
-       bne-    L(u3)
        cmpdi   cr1, rWORD1, 0
        bdz     L(u4)
        cmpd    rWORD1, rWORD2
        beq-    cr1, L(u4)
+       bne-    L(u4)
        lbzu    rWORD3, 1(rSTR1)
        lbzu    rWORD4, 1(rSTR2)
-       bne-    L(u4)
        cmpdi   cr1, rWORD3, 0
        bdz     L(u3)
        cmpd    rWORD3, rWORD4
        beq-    cr1, L(u3)
+       bne-    L(u3)
        lbzu    rWORD1, 1(rSTR1)
        lbzu    rWORD2, 1(rSTR2)
-       beq+    L(u1)
+       b       L(u1)
 
 L(u3):  sub     rRTN, rWORD3, rWORD4
         blr
index bba44455c32defb1688ccdd2d6d5e67b871238b4..eace179a6c4cc23efa03f0db057ac808a9da5e6c 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimized strcmp implementation for POWER7/PowerPC64.
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -147,30 +147,31 @@ L(u1):
        bdz     L(u4)
        cmpd    rWORD1,rWORD2
        beq     cr1,L(u4)
+       bne     L(u4)
        lbzu    rWORD3,1(rSTR1)
        lbzu    rWORD4,1(rSTR2)
-       bne     L(u4)
        cmpdi   cr1,rWORD3,0
        bdz     L(u3)
        cmpd    rWORD3,rWORD4
        beq     cr1,L(u3)
+       bne     L(u3)
        lbzu    rWORD1,1(rSTR1)
        lbzu    rWORD2,1(rSTR2)
-       bne     L(u3)
        cmpdi   cr1,rWORD1,0
        bdz     L(u4)
        cmpd    rWORD1,rWORD2
        beq     cr1,L(u4)
+       bne     L(u4)
        lbzu    rWORD3,1(rSTR1)
        lbzu    rWORD4,1(rSTR2)
-       bne     L(u4)
        cmpdi   cr1,rWORD3,0
        bdz     L(u3)
        cmpd    rWORD3,rWORD4
        beq     cr1,L(u3)
+       bne     L(u3)
        lbzu    rWORD1,1(rSTR1)
        lbzu    rWORD2,1(rSTR2)
-       beq     L(u1)
+       b       L(u1)
 
 L(u3):  sub    rRTN,rWORD3,rWORD4
        blr