diff mbox

[9/13] AArch64: Cleanup fenv implementation

Message ID 001301cfeee7$c9632dd0$5c298970$@com
State New
Headers show

Commit Message

Wilco Oct. 23, 2014, 5:35 p.m. UTC
Call libc_fesetround_aarch64 from math_private.h rather than duplicating functionality.

ChangeLog:
2014-10-23  Wilco Dijkstra  <wdijkstr@arm.com>

	* sysdeps/aarch64/fpu/fesetround.c (fesetround):
	Call libc_fesetround_aarch64.

---
 sysdeps/aarch64/fpu/fesetround.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

Comments

Marcus Shawcroft Dec. 18, 2014, 4:09 p.m. UTC | #1
On 23 October 2014 at 18:35, Wilco Dijkstra <wdijkstr@arm.com> wrote:
> Call libc_fesetround_aarch64 from math_private.h rather than duplicating functionality.
>
> ChangeLog:
> 2014-10-23  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * sysdeps/aarch64/fpu/fesetround.c (fesetround):
>         Call libc_fesetround_aarch64.
>
> ---
>  sysdeps/aarch64/fpu/fesetround.c | 26 +++++---------------------
>  1 file changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c
> index d34706d..540ef48 100644
> --- a/sysdeps/aarch64/fpu/fesetround.c
> +++ b/sysdeps/aarch64/fpu/fesetround.c
> @@ -16,32 +16,16 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>
> -#include <fenv.h>

Same comment as the other patches in this series.  Don't drop this
include, it contains the prototype for the function defined below.

OK with that change. /Marcus
diff mbox

Patch

diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c
index d34706d..540ef48 100644
--- a/sysdeps/aarch64/fpu/fesetround.c
+++ b/sysdeps/aarch64/fpu/fesetround.c
@@ -16,32 +16,16 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fenv.h>
+#include <math_private.h>
 #include <fpu_control.h>
 
 int
 fesetround (int round)
 {
-  fpu_control_t fpcr;
-  fpu_control_t fpcr_new;
+  if (round & ~_FPU_FPCR_RM_MASK)
+    return 1;
 
-  switch (round)
-    {
-    case FE_TONEAREST:
-    case FE_UPWARD:
-    case FE_DOWNWARD:
-    case FE_TOWARDZERO:
-      _FPU_GETCW (fpcr);
-      fpcr_new = (fpcr & ~FE_TOWARDZERO) | round;
-
-      if (fpcr != fpcr_new)
-	_FPU_SETCW (fpcr_new);
-      return 0;
-
-    default:
-      return 1;
-    }
-
-  return 1;
+  libc_fesetround_aarch64 (round);
+  return 0;
 }
 libm_hidden_def (fesetround)