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