about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-10-25 15:54:16 +0000
committerAurelien Jarno <aurelien@aurel32.net>2016-11-06 21:19:21 +0100
commit797c7fb1978abb1f6a6404e0453c4b775fc0cb2e (patch)
treeaaf0f231d2edd28614fd9d8f03ed9e7f8bc259c6
parentccebcff824e76f2d3905185b8ae9ff1b51607791 (diff)
downloadglibc-797c7fb1978abb1f6a6404e0453c4b775fc0cb2e.tar.gz
glibc-797c7fb1978abb1f6a6404e0453c4b775fc0cb2e.tar.xz
glibc-797c7fb1978abb1f6a6404e0453c4b775fc0cb2e.zip
Fix cmpli usage in power6 memset.
Building glibc for powerpc64 with recent (2.27.51.20161012) binutils,
with multi-arch enabled, I get the error:

../sysdeps/powerpc/powerpc64/power6/memset.S: Assembler messages:
../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (5 is not between 0 and 1)
../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: operand out of range (128 is not between 0 and 31)
../sysdeps/powerpc/powerpc64/power6/memset.S:254: Error: missing operand

Indeed, cmpli is documented as a four-operand instruction, and looking
at nearby code it seems likely cmpldi was intended.  This patch fixes
this powerpc64 code accordingly, and makes a corresponding change to
the powerpc32 code.

Tested for powerpc, powerpc64 and powerpc64le by Tulio Magno Quites
Machado Filho

	* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi
	instead of cmpli.
	* sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi
	instead of cmpli.

(cherry picked from commit 78b7adbaea643f2f213bb113e3ec933416a769a8)
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/powerpc/powerpc32/power6/memset.S2
-rw-r--r--sysdeps/powerpc/powerpc64/power6/memset.S2
3 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b2f6372bfa..7a3669c330 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-25  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi
+	instead of cmpli.
+	* sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi
+	instead of cmpli.
+
 2016-10-24  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/unix/sysv/linux/pread.c (__libc_pread): Use SYSCALL_LL_PRW.
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index b2a222edd2..d5dbe83af2 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -394,7 +394,7 @@ L(cacheAlignedx):
 /* A simple loop for the longer (>640 bytes) lengths.  This form limits
    the branch miss-predicted to exactly 1 at loop exit.*/
 L(cacheAligned512):
-	cmpli	cr1,rLEN,128
+	cmplwi	cr1,rLEN,128
 	blt	cr1,L(cacheAligned1)
 	dcbz	0,rMEMP
 	addi	rLEN,rLEN,-128
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index c2d1c4e600..d445b1e1ef 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -251,7 +251,7 @@ L(cacheAlignedx):
 /* A simple loop for the longer (>640 bytes) lengths.  This form limits
    the branch miss-predicted to exactly 1 at loop exit.*/
 L(cacheAligned512):
-	cmpli	cr1,rLEN,128
+	cmpldi	cr1,rLEN,128
 	blt	cr1,L(cacheAligned1)
 	dcbz	0,rMEMP
 	addi	rLEN,rLEN,-128