public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [02/12] Add femode_t functions: aarch64
@ 2016-09-02 21:54 Joseph Myers
  2016-09-06 15:28 ` Szabolcs Nagy
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2016-09-02 21:54 UTC (permalink / raw)
  To: libc-alpha; +Cc: marcus.shawcroft

This patch adds AArch64 versions of fegetmode and fesetmode.
Untested.

2016-09-02  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/aarch64/fpu/fegetmode.c: New file.
	* sysdeps/aarch64/fpu/fesetmode.c: Likewise.

diff --git a/sysdeps/aarch64/fpu/fegetmode.c b/sysdeps/aarch64/fpu/fegetmode.c
new file mode 100644
index 0000000..7e76acf
--- /dev/null
+++ b/sysdeps/aarch64/fpu/fegetmode.c
@@ -0,0 +1,27 @@
+/* Store current floating-point control modes.  AArch64 version.
+   Copyright (C) 2016 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/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fegetmode (femode_t *modep)
+{
+  _FPU_GETCW (*modep);
+  return 0;
+}
diff --git a/sysdeps/aarch64/fpu/fesetmode.c b/sysdeps/aarch64/fpu/fesetmode.c
new file mode 100644
index 0000000..d1b653e
--- /dev/null
+++ b/sysdeps/aarch64/fpu/fesetmode.c
@@ -0,0 +1,34 @@
+/* Install given floating-point control modes.  AArch64 version.
+   Copyright (C) 2016 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/>.  */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+fesetmode (const femode_t *modep)
+{
+  fpu_control_t fpcr, fpcr_new;
+  _FPU_GETCW (fpcr);
+  if (modep == FE_DFL_MODE)
+    fpcr_new = (fpcr & _FPU_RESERVED) | _FPU_DEFAULT;
+  else
+    fpcr_new = *modep;
+  if (fpcr != fpcr_new)
+    _FPU_SETCW (fpcr_new);
+  return 0;
+}

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [02/12] Add femode_t functions: aarch64
  2016-09-02 21:54 [02/12] Add femode_t functions: aarch64 Joseph Myers
@ 2016-09-06 15:28 ` Szabolcs Nagy
  2016-09-06 15:35   ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Szabolcs Nagy @ 2016-09-06 15:28 UTC (permalink / raw)
  To: Joseph Myers, libc-alpha; +Cc: nd, marcus.shawcroft

On 02/09/16 22:54, Joseph Myers wrote:
> This patch adds AArch64 versions of fegetmode and fesetmode.
> Untested.
> 
> 2016-09-02  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* sysdeps/aarch64/fpu/fegetmode.c: New file.
> 	* sysdeps/aarch64/fpu/fesetmode.c: Likewise.
> 

this passes the new
 math/test-femode
 math/test-femode-traps
tests (with patch [01/12]).

the later one outputs
"first feenableexcept failed, cannot test"
several times, maybe it should be UNSUPPORTED
in that case like math/test-fexcept-traps.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [02/12] Add femode_t functions: aarch64
  2016-09-06 15:28 ` Szabolcs Nagy
@ 2016-09-06 15:35   ` Joseph Myers
  0 siblings, 0 replies; 3+ messages in thread
From: Joseph Myers @ 2016-09-06 15:35 UTC (permalink / raw)
  To: Szabolcs Nagy; +Cc: libc-alpha, nd, marcus.shawcroft

On Tue, 6 Sep 2016, Szabolcs Nagy wrote:

> the later one outputs
> "first feenableexcept failed, cannot test"
> several times, maybe it should be UNSUPPORTED
> in that case like math/test-fexcept-traps.

The issue is the difference between a complete test being unsupported, and 
the individual subtests being unsupported.  test-fexcept-traps globally 
gates things on a single feenableexcept / EXCEPTION_ENABLE_SUPPORTED 
(FE_ALL_EXCEPT) test, whereas in the present patch it's each individual 
subtest (except the trivial ones) that detects that that particular 
subtest is unsupported.  (In practice I don't expect enabling traps to be 
supported for only a subset of exceptions.  It's e.g. libm-test.inc that 
can genuinely be a case of some subtests being supported and others not.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-06 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 21:54 [02/12] Add femode_t functions: aarch64 Joseph Myers
2016-09-06 15:28 ` Szabolcs Nagy
2016-09-06 15:35   ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).