8ae002
commit 78b7adbaea643f2f213bb113e3ec933416a769a8
8ae002
Author: Joseph Myers <joseph@codesourcery.com>
8ae002
Date:   Tue Oct 25 15:54:16 2016 +0000
8ae002
8ae002
    Fix cmpli usage in power6 memset.
8ae002
    
8ae002
    Building glibc for powerpc64 with recent (2.27.51.20161012) binutils,
8ae002
    with multi-arch enabled, I get the error:
8ae002
    
8ae002
    ../sysdeps/powerpc/powerpc64/power6/memset.S: Assembler messages:
8ae002
    ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (5 is not between 0 and 1)
8ae002
    ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (128 is not between 0 and 31)
8ae002
    ../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: missing operand
8ae002
    
8ae002
    Indeed, cmpli is documented as a four-operand instruction, and looking
8ae002
    at nearby code it seems likely cmpldi was intended.  This patch fixes
8ae002
    this powerpc64 code accordingly, and makes a corresponding change to
8ae002
    the powerpc32 code.
8ae002
    
8ae002
    Tested for powerpc, powerpc64 and powerpc64le by Tulio Magno Quites
8ae002
    Machado Filho
8ae002
    
8ae002
            * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi
8ae002
            instead of cmpli.
8ae002
            * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi
8ae002
            instead of cmpli.
8ae002
8ae002
diff -rup a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
8ae002
--- a/sysdeps/powerpc/powerpc32/power6/memset.S	2017-03-06 13:52:27.000000000 -0500
8ae002
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S	2017-03-06 13:54:49.705201476 -0500
8ae002
@@ -396,7 +396,7 @@ L(cacheAlignedx):
8ae002
 /* A simple loop for the longer (>640 bytes) lengths.  This form limits
8ae002
    the branch miss-predicted to exactly 1 at loop exit.*/
8ae002
 L(cacheAligned512):
8ae002
-	cmpli	cr1,rLEN,128
8ae002
+	cmplwi	cr1,rLEN,128
8ae002
 	blt	cr1,L(cacheAligned1)
8ae002
 	dcbz	0,rMEMP
8ae002
 	addi	rLEN,rLEN,-128
8ae002
diff -rup a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
8ae002
--- a/sysdeps/powerpc/powerpc64/power6/memset.S	2017-03-06 13:52:22.000000000 -0500
8ae002
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S	2017-03-06 13:54:35.824216755 -0500
8ae002
@@ -269,7 +269,7 @@ L(cacheAlignedx):
8ae002
 /* A simple loop for the longer (>640 bytes) lengths.  This form limits
8ae002
    the branch miss-predicted to exactly 1 at loop exit.*/
8ae002
 L(cacheAligned512):
8ae002
-	cmpli	cr1,rLEN,128
8ae002
+	cmpldi	cr1,rLEN,128
8ae002
 	blt	cr1,L(cacheAligned1)
8ae002
 	dcbz	0,rMEMP
8ae002
 	addi	rLEN,rLEN,-128