|
|
29e444 |
From 987322bc0b170570a7bd539480252453fcc7a6f5 Mon Sep 17 00:00:00 2001
|
|
|
29e444 |
From: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
29e444 |
Date: Fri, 29 Mar 2013 18:15:28 -0500
|
|
|
29e444 |
Subject: [PATCH 23/42] PowerPC: remove branch prediction from rint
|
|
|
29e444 |
implementation
|
|
|
29e444 |
|
|
|
29e444 |
The branch prediction hints is actually hurts performance in this case.
|
|
|
29e444 |
The assembly implementation make two assumptions: 1. 'fabs (x) < 2^52'
|
|
|
29e444 |
is unlikely and 2. 'x > 0.0' is unlike (if 1. is true). Since it a
|
|
|
29e444 |
general floating point function, expected input is not bounded and then
|
|
|
29e444 |
it is better to let the hardware handle the branches.
|
|
|
29e444 |
|
|
|
29e444 |
(backported from commit 60c414c346a1d5ef0510ffbdc0ab75f288ee4d3f)
|
|
|
29e444 |
|
|
|
29e444 |
This backport does not include the benchmark tests from the original
|
|
|
29e444 |
commit.
|
|
|
29e444 |
---
|
|
|
29e444 |
sysdeps/powerpc/powerpc32/fpu/s_rint.S | 6 +++---
|
|
|
29e444 |
sysdeps/powerpc/powerpc32/fpu/s_rintf.S | 6 +++---
|
|
|
29e444 |
sysdeps/powerpc/powerpc64/fpu/s_rint.S | 6 +++---
|
|
|
29e444 |
sysdeps/powerpc/powerpc64/fpu/s_rintf.S | 6 +++---
|
|
|
29e444 |
4 files changed, 12 insertions(+), 12 deletions(-)
|
|
|
29e444 |
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rint.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rint.S
|
|
|
29e444 |
index 0ab9e6c..c28e7f6 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rint.S
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rint.S
|
|
|
29e444 |
@@ -45,14 +45,14 @@ ENTRY (__rint)
|
|
|
29e444 |
fsub fp12,fp13,fp13 /* generate 0.0 */
|
|
|
29e444 |
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
|
|
|
29e444 |
fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
|
|
|
29e444 |
- bnllr- cr7
|
|
|
29e444 |
- bng- cr6,.L4
|
|
|
29e444 |
+ bnllr cr7
|
|
|
29e444 |
+ bng cr6,.L4
|
|
|
29e444 |
fadd fp1,fp1,fp13 /* x+= TWO52; */
|
|
|
29e444 |
fsub fp1,fp1,fp13 /* x-= TWO52; */
|
|
|
29e444 |
fabs fp1,fp1 /* if (x == 0.0) */
|
|
|
29e444 |
blr /* x = 0.0; */
|
|
|
29e444 |
.L4:
|
|
|
29e444 |
- bnllr- cr6 /* if (x < 0.0) */
|
|
|
29e444 |
+ bnllr cr6 /* if (x < 0.0) */
|
|
|
29e444 |
fsub fp1,fp1,fp13 /* x-= TWO52; */
|
|
|
29e444 |
fadd fp1,fp1,fp13 /* x+= TWO52; */
|
|
|
29e444 |
fnabs fp1,fp1 /* if (x == 0.0) */
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
|
|
|
29e444 |
index ddb47db..69aed9c 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
|
|
|
29e444 |
@@ -41,14 +41,14 @@ ENTRY (__rintf)
|
|
|
29e444 |
fsubs fp12,fp13,fp13 /* generate 0.0 */
|
|
|
29e444 |
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
|
|
|
29e444 |
fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
|
|
|
29e444 |
- bnllr- cr7
|
|
|
29e444 |
- bng- cr6,.L4
|
|
|
29e444 |
+ bnllr cr7
|
|
|
29e444 |
+ bng cr6,.L4
|
|
|
29e444 |
fadds fp1,fp1,fp13 /* x+= TWO23; */
|
|
|
29e444 |
fsubs fp1,fp1,fp13 /* x-= TWO23; */
|
|
|
29e444 |
fabs fp1,fp1 /* if (x == 0.0) */
|
|
|
29e444 |
blr /* x = 0.0; */
|
|
|
29e444 |
.L4:
|
|
|
29e444 |
- bnllr- cr6 /* if (x < 0.0) */
|
|
|
29e444 |
+ bnllr cr6 /* if (x < 0.0) */
|
|
|
29e444 |
fsubs fp1,fp1,fp13 /* x-= TWO23; */
|
|
|
29e444 |
fadds fp1,fp1,fp13 /* x+= TWO23; */
|
|
|
29e444 |
fnabs fp1,fp1 /* if (x == 0.0) */
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rint.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rint.S
|
|
|
29e444 |
index db62405..560905a 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rint.S
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rint.S
|
|
|
29e444 |
@@ -34,14 +34,14 @@ EALIGN (__rint, 4, 0)
|
|
|
29e444 |
fsub fp12,fp13,fp13 /* generate 0.0 */
|
|
|
29e444 |
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
|
|
|
29e444 |
fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
|
|
|
29e444 |
- bnllr- cr7
|
|
|
29e444 |
- bng- cr6,.L4
|
|
|
29e444 |
+ bnllr cr7
|
|
|
29e444 |
+ bng cr6,.L4
|
|
|
29e444 |
fadd fp1,fp1,fp13 /* x+= TWO52; */
|
|
|
29e444 |
fsub fp1,fp1,fp13 /* x-= TWO52; */
|
|
|
29e444 |
fabs fp1,fp1 /* if (x == 0.0) */
|
|
|
29e444 |
blr /* x = 0.0; */
|
|
|
29e444 |
.L4:
|
|
|
29e444 |
- bnllr- cr6 /* if (x < 0.0) */
|
|
|
29e444 |
+ bnllr cr6 /* if (x < 0.0) */
|
|
|
29e444 |
fsub fp1,fp1,fp13 /* x-= TWO52; */
|
|
|
29e444 |
fadd fp1,fp1,fp13 /* x+= TWO52; */
|
|
|
29e444 |
fnabs fp1,fp1 /* if (x == 0.0) */
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
|
|
|
29e444 |
index 248649d..c120d91 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
|
|
|
29e444 |
@@ -30,14 +30,14 @@ EALIGN (__rintf, 4, 0)
|
|
|
29e444 |
fsubs fp12,fp13,fp13 /* generate 0.0 */
|
|
|
29e444 |
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
|
|
|
29e444 |
fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
|
|
|
29e444 |
- bnllr- cr7
|
|
|
29e444 |
- bng- cr6,.L4
|
|
|
29e444 |
+ bnllr cr7
|
|
|
29e444 |
+ bng cr6,.L4
|
|
|
29e444 |
fadds fp1,fp1,fp13 /* x+= TWO23; */
|
|
|
29e444 |
fsubs fp1,fp1,fp13 /* x-= TWO23; */
|
|
|
29e444 |
fabs fp1,fp1 /* if (x == 0.0) */
|
|
|
29e444 |
blr /* x = 0.0; */
|
|
|
29e444 |
.L4:
|
|
|
29e444 |
- bnllr- cr6 /* if (x < 0.0) */
|
|
|
29e444 |
+ bnllr cr6 /* if (x < 0.0) */
|
|
|
29e444 |
fsubs fp1,fp1,fp13 /* x-= TWO23; */
|
|
|
29e444 |
fadds fp1,fp1,fp13 /* x+= TWO23; */
|
|
|
29e444 |
fnabs fp1,fp1 /* if (x == 0.0) */
|
|
|
29e444 |
--
|
|
|
29e444 |
1.7.11.7
|
|
|
29e444 |
|