about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/power8/memrchr.S
diff options
context:
space:
mode:
authorRaoni Fassina Firmino <raoni@linux.ibm.com>2019-06-27 15:44:17 -0300
committerGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-08-01 15:57:50 -0300
commit066020c5e8cb22f885be6f46a5f114f2d1e74c6b (patch)
tree984159ff90ba2c47e9a7e20bfd987bc2091a8d3a /sysdeps/powerpc/powerpc64/power8/memrchr.S
parent3175dcc1e67425ad471caddc3d3cfae357de26ff (diff)
downloadglibc-066020c5e8cb22f885be6f46a5f114f2d1e74c6b.tar.gz
glibc-066020c5e8cb22f885be6f46a5f114f2d1e74c6b.tar.xz
glibc-066020c5e8cb22f885be6f46a5f114f2d1e74c6b.zip
powerpc: Cleanup: use actual power8 assembly mnemonics
Some implementations in sysdeps/powerpc/powerpc64/power8/*.S still had
pre power8 compatible binutils hardcoded macros and were not using
.machine power8.

This patch should not have semantic changes, in fact it should have the
same exact code generated.

Tested that generated stripped shared objects are identical when
using "strip --remove-section=.note.gnu.build-id".

Checked on:
- powerpc64le, power9, build-many-glibcs.py, gcc 6.4.1 20180104, binutils 2.26.2.20160726
- powerpc64le, power8, debian 9, gcc 6.3.0 20170516, binutils 2.28
- powerpc64le, power9, ubuntu 19.04, gcc 8.3.0, binutils 2.32
- powerpc64le, power9, opensuse tumbleweed, gcc 9.1.1 20190527, binutils 2.32
- powerpc64, power9, debian 10, gcc 8.3.0, binutils 2.31.1

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/powerpc64/power8/memrchr.S')
-rw-r--r--sysdeps/powerpc/powerpc64/power8/memrchr.S30
1 files changed, 11 insertions, 19 deletions
diff --git a/sysdeps/powerpc/powerpc64/power8/memrchr.S b/sysdeps/powerpc/powerpc64/power8/memrchr.S
index 51c6937c5f..77e5b4cc9d 100644
--- a/sysdeps/powerpc/powerpc64/power8/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/memrchr.S
@@ -21,18 +21,10 @@
 
 /* int [r3] memrchr (char *s [r3], int byte [r4], int size [r5])  */
 
-/* TODO: change these to the actual instructions when the minimum required
-   binutils allows it.  */
-#define MTVRD(v, r) .long (0x7c000167 | ((v)<<(32-11)) | ((r)<<(32-16)))
-#define MFVRD(r, v) .long (0x7c000067 | ((v)<<(32-11)) | ((r)<<(32-16)))
-#define VBPERMQ(t, a, b)  .long (0x1000054c \
-				| ((t)<<(32-11)) \
-				| ((a)<<(32-16)) \
-				| ((b)<<(32-21)) )
 #ifndef MEMRCHR
 # define MEMRCHR __memrchr
 #endif
-	.machine  power7
+	.machine  power8
 ENTRY_TOCLESS (MEMRCHR)
 	CALL_MCOUNT 3
 	add	r7, r3, r5      /* Calculate the last acceptable address.  */
@@ -92,7 +84,7 @@ L(align_qw):
 	li	r0, 0
 	lvsl	v11, r0, r0
 	vslb	v10, v11, v10
-	MTVRD(v1, r4)
+	mtvrd	v1, r4
 	vspltb	v1, v1, 7
 	cmpldi	r5, 64
 	ble	L(tail64)
@@ -205,10 +197,10 @@ L(tail64):
 	.align	4
 L(found):
 	/* Permute the first bit of each byte into bits 48-63.  */
-	VBPERMQ(v6, v6, v10)
-	VBPERMQ(v7, v7, v10)
-	VBPERMQ(v8, v8, v10)
-	VBPERMQ(v9, v9, v10)
+	vbpermq	v6, v6, v10
+	vbpermq	v7, v7, v10
+	vbpermq	v8, v8, v10
+	vbpermq	v9, v9, v10
 	/* Shift each component into its correct position for merging.  */
 #ifdef __LITTLE_ENDIAN__
 	vsldoi	v7, v7, v7, 2
@@ -223,7 +215,7 @@ L(found):
 	vor	v11, v6, v7
 	vor	v4, v9, v8
 	vor	v4, v11, v4
-	MFVRD(r5, v4)
+	mfvrd	r5, v4
 #ifdef __LITTLE_ENDIAN__
 	cntlzd	r6, r5	/* Count leading zeros before the match.  */
 #else
@@ -245,7 +237,7 @@ L(found_16B):
 	bge	L(last)
 	/* Now discard bytes before starting address.  */
 	sub	r9, r10, r8
-	MTVRD(v9, r9)
+	mtvrd	v9, r9
 	vspltisb	v8, 3
 	/* Mask unwanted bytes.  */
 #ifdef __LITTLE_ENDIAN__
@@ -263,14 +255,14 @@ L(found_16B):
 #endif
 L(last):
 	/* Permute the first bit of each byte into bits 48-63.  */
-	VBPERMQ(v6, v6, v10)
+	vbpermq	v6, v6, v10
 	/* Shift each component into its correct position for merging.  */
 #ifdef __LITTLE_ENDIAN__
 	vsldoi	v6, v6, v6, 6
-	MFVRD(r7, v6)
+	mfvrd	r7, v6
 	cntlzd	r6, r7	/* Count leading zeros before the match.  */
 #else
-	MFVRD(r7, v6)
+	mfvrd	r7, v6
 	addi	r6, r7, -1
 	andc	r6, r6, r7
 	popcntd	r6, r6