olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-ppc64le-32.patch

ce426f
# commit 3be87c77d24c4456ccca4034363b6d1814cd0c84
ce426f
# Author: Alan Modra <amodra@gmail.com>
ce426f
# Date:   Sat Aug 17 18:47:59 2013 +0930
ce426f
# 
ce426f
#     PowerPC LE memset
ce426f
#     http://sourceware.org/ml/libc-alpha/2013-08/msg00104.html
ce426f
#     
ce426f
#     One of the things I noticed when looking at power7 timing is that rlwimi
ce426f
#     is cracked and the two resulting insns have a register dependency.
ce426f
#     That makes it a little slower than the equivalent rldimi.
ce426f
#     
ce426f
#         * sysdeps/powerpc/powerpc64/memset.S: Replace rlwimi with
ce426f
#             insrdi.  Formatting.
ce426f
#         * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
ce426f
#         * sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
ce426f
#         * sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
ce426f
#         * sysdeps/powerpc/powerpc32/power4/memset.S: Likewise.
ce426f
#         * sysdeps/powerpc/powerpc32/power6/memset.S: Likewise.
ce426f
#         * sysdeps/powerpc/powerpc32/power7/memset.S: Likewise.
ce426f
# 
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -52,7 +52,7 @@
ce426f
 
ce426f
 /* Align to word boundary.  */
ce426f
 	cmplwi	cr5, rLEN, 31
ce426f
-	rlwimi	rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword.  */
ce426f
+	insrdi	rCHR, rCHR, 8, 48     /* Replicate byte to halfword.  */
ce426f
 	beq+	L(aligned)
ce426f
 	mtcrf	0x01, rMEMP0
ce426f
 	subfic	rALIGN, rALIGN, 4
ce426f
@@ -67,7 +67,7 @@
ce426f
 /* Handle the case of size < 31.  */
ce426f
 L(aligned):
ce426f
 	mtcrf	0x01, rLEN
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32    /* Replicate halfword to word.  */
ce426f
 	ble	cr5, L(medium)
ce426f
 /* Align to 32-byte boundary.  */
ce426f
 	andi.	rALIGN, rMEMP, 0x1C
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -50,7 +50,7 @@
ce426f
 	ble-	cr1, L(small)
ce426f
 /* Align to word boundary.  */
ce426f
 	cmplwi	cr5, rLEN, 31
ce426f
-	rlwimi	rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword.  */
ce426f
+	insrdi	rCHR, rCHR, 8, 48	/* Replicate byte to halfword.  */
ce426f
 	beq+	L(aligned)
ce426f
 	mtcrf	0x01, rMEMP0
ce426f
 	subfic	rALIGN, rALIGN, 4
ce426f
@@ -66,7 +66,7 @@
ce426f
 /* Handle the case of size < 31.  */
ce426f
 L(aligned):
ce426f
 	mtcrf	0x01, rLEN
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 	ble	cr5, L(medium)
ce426f
 /* Align to 32-byte boundary.  */
ce426f
 	andi.	rALIGN, rMEMP, 0x1C
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -37,8 +37,8 @@
ce426f
 	cfi_offset(31,-8)
ce426f
 
ce426f
 	/* Replicate byte to word.  */
ce426f
-	rlwimi	4,4,8,16,23
ce426f
-	rlwimi	4,4,16,0,15
ce426f
+	insrdi	4,4,8,48
ce426f
+	insrdi	4,4,16,32
ce426f
 
ce426f
 	ble	cr6,L(small)	/* If length <= 8, use short copy code.  */
ce426f
 
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -73,14 +73,14 @@
ce426f
 
ce426f
 /* Align to doubleword boundary.  */
ce426f
 	cmpldi	cr5, rLEN, 31
ce426f
-	rlwimi	rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword.  */
ce426f
+	insrdi	rCHR, rCHR, 8, 48	/* Replicate byte to halfword.  */
ce426f
 	beq+	L(aligned2)
ce426f
 	mtcrf	0x01, rMEMP0
ce426f
 	subfic	rALIGN, rALIGN, 8
ce426f
 	cror	28,30,31		/* Detect odd word aligned.  */
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
 	sub	rLEN, rLEN, rALIGN
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 	bt	29, L(g4)
ce426f
 /* Process the even word of doubleword.  */
ce426f
 	bf+	31, L(g2)
ce426f
@@ -102,14 +102,14 @@
ce426f
 
ce426f
 /* Handle the case of size < 31.  */
ce426f
 L(aligned2):
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 L(aligned):
ce426f
 	mtcrf	0x01, rLEN
ce426f
 	ble	cr5, L(medium)
ce426f
 /* Align to 32-byte boundary.  */
ce426f
 	andi.	rALIGN, rMEMP, 0x18
ce426f
 	subfic	rALIGN, rALIGN, 0x20
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word. */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word. */
ce426f
 	beq	L(caligned)
ce426f
 	mtcrf	0x01, rALIGN
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
@@ -230,7 +230,7 @@
ce426f
 /* Memset of 0-31 bytes.  */
ce426f
 	.align 5
ce426f
 L(medium):
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word.  */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word.  */
ce426f
 	cmpldi	cr1, rLEN, 16
ce426f
 L(medium_tail2):
ce426f
 	add	rMEMP, rMEMP, rLEN
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -68,14 +68,14 @@
ce426f
 
ce426f
 /* Align to doubleword boundary.  */
ce426f
 	cmpldi	cr5, rLEN, 31
ce426f
-	rlwimi	rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword.  */
ce426f
+	insrdi	rCHR, rCHR, 8, 48	/* Replicate byte to halfword.  */
ce426f
 	beq+	L(aligned2)
ce426f
 	mtcrf	0x01, rMEMP0
ce426f
 	subfic	rALIGN, rALIGN, 8
ce426f
 	cror	28,30,31		/* Detect odd word aligned.  */
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
 	sub	rLEN, rLEN, rALIGN
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 	bt	29, L(g4)
ce426f
 /* Process the even word of doubleword.  */
ce426f
 	bf+	31, L(g2)
ce426f
@@ -97,14 +97,14 @@
ce426f
 
ce426f
 /* Handle the case of size < 31.  */
ce426f
 L(aligned2):
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 L(aligned):
ce426f
 	mtcrf	0x01, rLEN
ce426f
 	ble	cr5, L(medium)
ce426f
 /* Align to 32-byte boundary.  */
ce426f
 	andi.	rALIGN, rMEMP, 0x18
ce426f
 	subfic	rALIGN, rALIGN, 0x20
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word. */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word. */
ce426f
 	beq	L(caligned)
ce426f
 	mtcrf	0x01, rALIGN
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
@@ -164,24 +164,24 @@
ce426f
 L(getCacheAligned):
ce426f
 	cmpldi	cr1,rLEN,32
ce426f
 	andi.	rTMP,rMEMP,127
ce426f
-	blt		cr1,L(handletail32)
ce426f
-	beq		L(cacheAligned)
ce426f
+	blt	cr1,L(handletail32)
ce426f
+	beq	L(cacheAligned)
ce426f
 	addi	rMEMP,rMEMP,32
ce426f
 	addi	rLEN,rLEN,-32
ce426f
-	std		rCHR,-32(rMEMP)
ce426f
-	std		rCHR,-24(rMEMP)
ce426f
-	std		rCHR,-16(rMEMP)
ce426f
-	std		rCHR,-8(rMEMP)
ce426f
-	b		L(getCacheAligned)
ce426f
+	std	rCHR,-32(rMEMP)
ce426f
+	std	rCHR,-24(rMEMP)
ce426f
+	std	rCHR,-16(rMEMP)
ce426f
+	std	rCHR,-8(rMEMP)
ce426f
+	b	L(getCacheAligned)
ce426f
 
ce426f
 /* Now we are aligned to the cache line and can use dcbz.  */
ce426f
 L(cacheAligned):
ce426f
 	cmpld	cr1,rLEN,rCLS
ce426f
-	blt		cr1,L(handletail32)
ce426f
+	blt	cr1,L(handletail32)
ce426f
 	dcbz	0,rMEMP
ce426f
 	subf	rLEN,rCLS,rLEN
ce426f
-	add		rMEMP,rMEMP,rCLS
ce426f
-	b		L(cacheAligned)
ce426f
+	add	rMEMP,rMEMP,rCLS
ce426f
+	b	L(cacheAligned)
ce426f
 
ce426f
 /* We are here because the cache line size was set and was not 32-bytes
ce426f
    and the remainder (rLEN) is less than the actual cache line size.
ce426f
@@ -218,7 +218,7 @@
ce426f
 /* Memset of 0-31 bytes.  */
ce426f
 	.align 5
ce426f
 L(medium):
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word.  */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word.  */
ce426f
 	cmpldi	cr1, rLEN, 16
ce426f
 L(medium_tail2):
ce426f
 	add	rMEMP, rMEMP, rLEN
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -65,14 +65,14 @@
ce426f
 
ce426f
 /* Align to doubleword boundary.  */
ce426f
 	cmpldi	cr5, rLEN, 31
ce426f
-	rlwimi	rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword.  */
ce426f
+	insrdi	rCHR, rCHR, 8, 48	/* Replicate byte to halfword.  */
ce426f
 	beq+	L(aligned2)
ce426f
 	mtcrf	0x01, rMEMP0
ce426f
 	subfic	rALIGN, rALIGN, 8
ce426f
 	cror	28,30,31		/* Detect odd word aligned.  */
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
 	sub	rLEN, rLEN, rALIGN
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 	bt	29, L(g4)
ce426f
 /* Process the even word of doubleword.  */
ce426f
 	bf+	31, L(g2)
ce426f
@@ -94,14 +94,14 @@
ce426f
 
ce426f
 /* Handle the case of size < 31.  */
ce426f
 L(aligned2):
ce426f
-	rlwimi	rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word.  */
ce426f
+	insrdi	rCHR, rCHR, 16, 32	/* Replicate halfword to word.  */
ce426f
 L(aligned):
ce426f
 	mtcrf	0x01, rLEN
ce426f
 	ble	cr5, L(medium)
ce426f
 /* Align to 32-byte boundary.  */
ce426f
 	andi.	rALIGN, rMEMP, 0x18
ce426f
 	subfic	rALIGN, rALIGN, 0x20
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word. */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word. */
ce426f
 	beq	L(caligned)
ce426f
 	mtcrf	0x01, rALIGN
ce426f
 	add	rMEMP, rMEMP, rALIGN
ce426f
@@ -362,7 +362,7 @@
ce426f
 /* Memset of 0-31 bytes.  */
ce426f
 	.align 5
ce426f
 L(medium):
ce426f
-	insrdi	rCHR,rCHR,32,0 /* Replicate word to double word.  */
ce426f
+	insrdi	rCHR, rCHR, 32, 0	/* Replicate word to double word.  */
ce426f
 	cmpldi	cr1, rLEN, 16
ce426f
 L(medium_tail2):
ce426f
 	add	rMEMP, rMEMP, rLEN
ce426f
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S
ce426f
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S	2014-05-29 13:07:41.000000000 -0500
ce426f
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S	2014-05-29 13:07:46.000000000 -0500
ce426f
@@ -34,8 +34,8 @@
ce426f
 	mr	10,3
ce426f
 
ce426f
 	/* Replicate byte to word.  */
ce426f
-	rlwimi	4,4,8,16,23
ce426f
-	rlwimi	4,4,16,0,15
ce426f
+	insrdi	4,4,8,48
ce426f
+	insrdi	4,4,16,32
ce426f
 	ble	cr6,L(small)	/* If length <= 8, use short copy code.  */
ce426f
 
ce426f
 	neg	0,3
ce426f
@@ -323,7 +323,7 @@
ce426f
 	clrldi	0,0,62
ce426f
 	beq	L(medium_aligned)
ce426f
 
ce426f
-	/* Force 4-bytes alignment for SRC.  */
ce426f
+	/* Force 4-bytes alignment for DST.  */
ce426f
 	mtocrf	0x01,0
ce426f
 	subf	5,0,5
ce426f
 1:	/* Copy 1 byte.  */