public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: libc-ports@sourceware.org
Subject: Re: alpha, ia64, hppa ports need get-rounding-mode.h
Date: Thu, 13 Sep 2012 14:37:00 -0000	[thread overview]
Message-ID: <5051EF9D.7090204@twiddle.net> (raw)
In-Reply-To: <Pine.LNX.4.64.1209122336470.15730@digraph.polyomino.org.uk>

[-- Attachment #1: Type: text/plain, Size: 130 bytes --]

On 09/12/2012 04:39 PM, Joseph S. Myers wrote:
> the alpha, ia64 and hppa ports need a get-rounding-mode.h header ...

Done.


r~

[-- Attachment #2: z --]
[-- Type: text/plain, Size: 1535 bytes --]

	* sysdeps/alpha/fpu/get-rounding-mode.h: New file.


diff --git a/ports/sysdeps/alpha/fpu/get-rounding-mode.h b/ports/sysdeps/alpha/fpu/get-rounding-mode.h
new file mode 100644
index 0000000..9d5b724
--- /dev/null
+++ b/ports/sysdeps/alpha/fpu/get-rounding-mode.h
@@ -0,0 +1,35 @@
+/* Determine floating-point rounding mode within libc.  Alpha version.
+   Copyright (C) 2012 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 ALPHA_GET_ROUNDING_MODE_H
+#define ALPHA_GET_ROUNDING_MODE_H	1
+
+#include <fenv.h>
+#include <fenv_libc.h>
+
+/* Return the floating-point rounding mode.  */
+
+static inline int
+get_rounding_mode (void)
+{
+  unsigned long fpcr;
+  __asm__ __volatile__("excb; mf_fpcr %0" : "=f"(fpcr));
+  return (fpcr >> FPCR_ROUND_SHIFT) & 3;
+}
+
+#endif /* get-rounding-mode.h */

  parent reply	other threads:[~2012-09-13 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 23:39 Joseph S. Myers
2012-09-13  2:51 ` Carlos O'Donell
2012-09-13 14:37 ` Richard Henderson [this message]
2012-09-24 23:23 ` [PATCH] ia64: define new get-rounding-mode.h header Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5051EF9D.7090204@twiddle.net \
    --to=rth@twiddle.net \
    --cc=libc-ports@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).