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