diff options
author | Paul A. Clarke <pc@us.ibm.com> | 2019-03-15 19:04:24 -0400 |
---|---|---|
committer | Paul A. Clarke <pc@us.ibm.com> | 2019-06-06 14:11:56 -0500 |
commit | de751ebc9efa97ce0115e42bd55fa1beeb614380 (patch) | |
tree | 5dd54e292a36158dba41efd8491908f05365b3f8 /sysdeps/powerpc/fpu | |
parent | 28dd3939221ab26c6774097e9596e30d9753f758 (diff) | |
download | glibc-de751ebc9efa97ce0115e42bd55fa1beeb614380.tar.gz glibc-de751ebc9efa97ce0115e42bd55fa1beeb614380.tar.xz glibc-de751ebc9efa97ce0115e42bd55fa1beeb614380.zip |
[powerpc] get_rounding_mode: utilize faster method to get rounding mode
Add support to use 'mffsl' instruction if compiled for POWER9 (or later). Also, mask the result to avoid bleeding unrelated bits into the result of _FPU_GET_RC(). Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/fpu')
-rw-r--r-- | sysdeps/powerpc/fpu/get-rounding-mode.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sysdeps/powerpc/fpu/get-rounding-mode.h b/sysdeps/powerpc/fpu/get-rounding-mode.h new file mode 100644 index 0000000000..e2fdbbbcce --- /dev/null +++ b/sysdeps/powerpc/fpu/get-rounding-mode.h @@ -0,0 +1,33 @@ +/* Determine floating-point rounding mode within libc. powerpc64 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _POWERPC64_GET_ROUNDING_MODE_H +#define _POWERPC64_GET_ROUNDING_MODE_H 1 + +#include <fenv.h> +#include <fpu_control.h> + +/* Return the floating-point rounding mode. */ + +static inline int +get_rounding_mode (void) +{ + return _FPU_GET_RC (); +} + +#endif /* get-rounding-mode.h */ |