public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: libc-alpha@sourceware.org, joseph@codesourcery.com
Cc: Andrew Waterman <andrew@sifive.com>,
	Darius Rad <darius@bluespec.com>,
	dj@redhat.com,    patches@groups.riscv.org,
	Palmer Dabbelt <palmer@dabbelt.com>
Subject: [PATCH 10/17] RISC-V: RV32D, RV64F, and RV64D Support
Date: Thu, 25 Jan 2018 04:37:00 -0000	[thread overview]
Message-ID: <20180125043621.19972-11-palmer@dabbelt.com> (raw)
In-Reply-To: <20180125043621.19972-1-palmer@dabbelt.com>

This patch adds support for the various other hardware floating point
configurations that RISC-V supports.  This is split from the RV32F patch
to avoid mailing list size restrictions.
---
 sysdeps/riscv/rv32/rvd/s_lrint.c     | 31 +++++++++++++++++++++
 sysdeps/riscv/rv32/rvd/s_lround.c    | 31 +++++++++++++++++++++
 sysdeps/riscv/rv32/rvf/s_lrintf.c    | 31 +++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_ceil.c      | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_floor.c     | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_llrint.c    | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_llround.c   | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_lrint.c     | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_lround.c    | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_nearbyint.c | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_rint.c      | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_round.c     | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_roundeven.c | 53 ++++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvd/s_trunc.c     | 52 +++++++++++++++++++++++++++++++++++
 sysdeps/riscv/rv64/rvf/s_llrintf.c   | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvf/s_llroundf.c  | 30 ++++++++++++++++++++
 sysdeps/riscv/rv64/rvf/s_lrintf.c    | 31 +++++++++++++++++++++
 sysdeps/riscv/rv64/rvf/s_lroundf.c   | 31 +++++++++++++++++++++
 sysdeps/riscv/rvd/e_sqrt.c           | 27 ++++++++++++++++++
 sysdeps/riscv/rvd/s_copysign.c       | 28 +++++++++++++++++++
 sysdeps/riscv/rvd/s_finite.c         | 28 +++++++++++++++++++
 sysdeps/riscv/rvd/s_fma.c            | 30 ++++++++++++++++++++
 sysdeps/riscv/rvd/s_fmax.c           | 28 +++++++++++++++++++
 sysdeps/riscv/rvd/s_fmin.c           | 28 +++++++++++++++++++
 sysdeps/riscv/rvd/s_fpclassify.c     | 36 ++++++++++++++++++++++++
 sysdeps/riscv/rvd/s_isinf.c          | 29 ++++++++++++++++++++
 sysdeps/riscv/rvd/s_isnan.c          | 28 +++++++++++++++++++
 sysdeps/riscv/rvd/s_issignaling.c    | 27 ++++++++++++++++++
 28 files changed, 989 insertions(+)
 create mode 100644 sysdeps/riscv/rv32/rvd/s_lrint.c
 create mode 100644 sysdeps/riscv/rv32/rvd/s_lround.c
 create mode 100644 sysdeps/riscv/rv32/rvf/s_lrintf.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_ceil.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_floor.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_llrint.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_llround.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_lrint.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_lround.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_nearbyint.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_rint.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_round.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_roundeven.c
 create mode 100644 sysdeps/riscv/rv64/rvd/s_trunc.c
 create mode 100644 sysdeps/riscv/rv64/rvf/s_llrintf.c
 create mode 100644 sysdeps/riscv/rv64/rvf/s_llroundf.c
 create mode 100644 sysdeps/riscv/rv64/rvf/s_lrintf.c
 create mode 100644 sysdeps/riscv/rv64/rvf/s_lroundf.c
 create mode 100644 sysdeps/riscv/rvd/e_sqrt.c
 create mode 100644 sysdeps/riscv/rvd/s_copysign.c
 create mode 100644 sysdeps/riscv/rvd/s_finite.c
 create mode 100644 sysdeps/riscv/rvd/s_fma.c
 create mode 100644 sysdeps/riscv/rvd/s_fmax.c
 create mode 100644 sysdeps/riscv/rvd/s_fmin.c
 create mode 100644 sysdeps/riscv/rvd/s_fpclassify.c
 create mode 100644 sysdeps/riscv/rvd/s_isinf.c
 create mode 100644 sysdeps/riscv/rvd/s_isnan.c
 create mode 100644 sysdeps/riscv/rvd/s_issignaling.c

diff --git a/sysdeps/riscv/rv32/rvd/s_lrint.c b/sysdeps/riscv/rv32/rvd/s_lrint.c
new file mode 100644
index 000000000000..4d5bdbc200e4
--- /dev/null
+++ b/sysdeps/riscv/rv32/rvd/s_lrint.c
@@ -0,0 +1,31 @@
+/* lrint().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+long int
+__lrint (double x)
+{
+  int32_t res;
+  asm ("fcvt.w.d %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__lrint, lrint)
diff --git a/sysdeps/riscv/rv32/rvd/s_lround.c b/sysdeps/riscv/rv32/rvd/s_lround.c
new file mode 100644
index 000000000000..f5d9cf2e070a
--- /dev/null
+++ b/sysdeps/riscv/rv32/rvd/s_lround.c
@@ -0,0 +1,31 @@
+/* lround().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+long int
+__lround (double x)
+{
+  int32_t res;
+  asm ("fcvt.w.d %0, %1, rmm" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__lround, lround)
diff --git a/sysdeps/riscv/rv32/rvf/s_lrintf.c b/sysdeps/riscv/rv32/rvf/s_lrintf.c
new file mode 100644
index 000000000000..08d44fa7385a
--- /dev/null
+++ b/sysdeps/riscv/rv32/rvf/s_lrintf.c
@@ -0,0 +1,31 @@
+/* lrintf().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-float.h>
+#include <stdint.h>
+
+long int
+__lrintf (float x)
+{
+  int32_t res;
+  asm ("fcvt.w.s %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/riscv/rv64/rvd/s_ceil.c b/sysdeps/riscv/rv64/rvd/s_ceil.c
new file mode 100644
index 000000000000..af99ecca3d07
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_ceil.c
@@ -0,0 +1,52 @@
+/* ceil().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__ceil (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1, rup" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1, rup" : "=f" (new_x) : "r" (i));
+
+      /* ceil(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/riscv/rv64/rvd/s_floor.c b/sysdeps/riscv/rv64/rvd/s_floor.c
new file mode 100644
index 000000000000..f34af98cce40
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_floor.c
@@ -0,0 +1,52 @@
+/* floor().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__floor (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1, rdn" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1, rdn" : "=f" (new_x) : "r" (i));
+
+      /* floor(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+libm_alias_double (__floor, floor)
diff --git a/sysdeps/riscv/rv64/rvd/s_llrint.c b/sysdeps/riscv/rv64/rvd/s_llrint.c
new file mode 100644
index 000000000000..8f37090d743a
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_llrint.c
@@ -0,0 +1,30 @@
+/* llrint().  RISC-V version.
+   Copyright (C) 2017-2018 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 <libm-alias-double.h>
+#include <stdint.h>
+
+long long int
+__llrint (double x)
+{
+  int64_t res;
+  asm ("fcvt.l.d %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/riscv/rv64/rvd/s_llround.c b/sysdeps/riscv/rv64/rvd/s_llround.c
new file mode 100644
index 000000000000..b7e448876be3
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_llround.c
@@ -0,0 +1,30 @@
+/* llround().  RISC-V version.
+   Copyright (C) 2017-2018 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 <libm-alias-double.h>
+#include <stdint.h>
+
+long long int
+__llround (double x)
+{
+  int64_t res;
+  asm ("fcvt.l.d %0, %1, rmm" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__llround, llround)
diff --git a/sysdeps/riscv/rv64/rvd/s_lrint.c b/sysdeps/riscv/rv64/rvd/s_lrint.c
new file mode 100644
index 000000000000..48f61be96676
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_lrint.c
@@ -0,0 +1,30 @@
+/* lrint().  RISC-V version.
+   Copyright (C) 2017-2018 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 <libm-alias-double.h>
+#include <stdint.h>
+
+long int
+__lrint (double x)
+{
+  int64_t res;
+  asm ("fcvt.l.d %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__lrint, lrint)
diff --git a/sysdeps/riscv/rv64/rvd/s_lround.c b/sysdeps/riscv/rv64/rvd/s_lround.c
new file mode 100644
index 000000000000..392233cd048c
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_lround.c
@@ -0,0 +1,30 @@
+/* llround().  RISC-V version.
+   Copyright (C) 2017-2018 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 <libm-alias-double.h>
+#include <stdint.h>
+
+long int
+__lround (double x)
+{
+  int64_t res;
+  asm ("fcvt.l.d %0, %1, rmm" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_double (__lround, lround)
diff --git a/sysdeps/riscv/rv64/rvd/s_nearbyint.c b/sysdeps/riscv/rv64/rvd/s_nearbyint.c
new file mode 100644
index 000000000000..e17f03842908
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_nearbyint.c
@@ -0,0 +1,52 @@
+/* nearbyint().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__nearbyint (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1" : "=f" (new_x) : "r" (i));
+
+      /* nearbyint(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/riscv/rv64/rvd/s_rint.c b/sysdeps/riscv/rv64/rvd/s_rint.c
new file mode 100644
index 000000000000..ef2380ea7fda
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_rint.c
@@ -0,0 +1,52 @@
+/* rint().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__rint (double x)
+{
+  bool nan;
+  double mag;
+
+  nan = isnan (x);
+  mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm ("fcvt.l.d %0, %1" : "=r" (i) : "f" (x));
+      asm ("fcvt.d.l %0, %1" : "=f" (new_x) : "r" (i));
+
+      /* rint(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+    }
+
+  return x;
+}
+
+libm_alias_double (__rint, rint)
diff --git a/sysdeps/riscv/rv64/rvd/s_round.c b/sysdeps/riscv/rv64/rvd/s_round.c
new file mode 100644
index 000000000000..22cff63e093b
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_round.c
@@ -0,0 +1,52 @@
+/* round().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__round (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1, rmm" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1, rmm" : "=f" (new_x) : "r" (i));
+
+      /* round(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+libm_alias_double (__round, round)
diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c
new file mode 100644
index 000000000000..26a0b2ded3d1
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_roundeven.c
@@ -0,0 +1,53 @@
+/* Round to nearest integer value, rounding halfway cases to even.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__roundeven (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1, rne" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1, rne" : "=f" (new_x) : "r" (i));
+
+      /* roundeven(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+hidden_def (__roundeven)
+libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/riscv/rv64/rvd/s_trunc.c b/sysdeps/riscv/rv64/rvd/s_trunc.c
new file mode 100644
index 000000000000..a0f78e6cd186
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/s_trunc.c
@@ -0,0 +1,52 @@
+/* trunc().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__trunc (double x)
+{
+  int flags = riscv_getflags ();
+  bool nan = isnan (x);
+  double mag = fabs (x);
+
+  if (nan)
+    return x + x;
+
+  if (mag < (1ULL << __DBL_MANT_DIG__))
+    {
+      int64_t i;
+      double new_x;
+
+      asm volatile ("fcvt.l.d %0, %1, rtz" : "=r" (i) : "f" (x));
+      asm volatile ("fcvt.d.l %0, %1, rtz" : "=f" (new_x) : "r" (i));
+
+      /* trunc(-0) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+
+      riscv_setflags (flags);
+    }
+
+  return x;
+}
+
+libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/riscv/rv64/rvf/s_llrintf.c b/sysdeps/riscv/rv64/rvf/s_llrintf.c
new file mode 100644
index 000000000000..ddfda6cfe2f6
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvf/s_llrintf.c
@@ -0,0 +1,30 @@
+/* Round argument to nearest integral value according to current direction.
+   Copyright (C) 2017-2018 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 <libm-alias-float.h>
+#include <stdint.h>
+
+long long int
+__llrintf (float x)
+{
+  int64_t res;
+  asm ("fcvt.l.s %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_float (__llrint, llrint)
diff --git a/sysdeps/riscv/rv64/rvf/s_llroundf.c b/sysdeps/riscv/rv64/rvf/s_llroundf.c
new file mode 100644
index 000000000000..7132f81d2fda
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvf/s_llroundf.c
@@ -0,0 +1,30 @@
+/* Round float value to long long int.  RISC-V version.
+   Copyright (C) 2017-2018 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 <libm-alias-float.h>
+#include <stdint.h>
+
+long long int
+__llroundf (float x)
+{
+  int64_t res;
+  asm ("fcvt.l.s %0, %1, rmm" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_float (__llround, llround)
diff --git a/sysdeps/riscv/rv64/rvf/s_lrintf.c b/sysdeps/riscv/rv64/rvf/s_lrintf.c
new file mode 100644
index 000000000000..d8b2fe88bf5a
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvf/s_lrintf.c
@@ -0,0 +1,31 @@
+/* lrintf().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-float.h>
+#include <stdint.h>
+
+long int
+__lrintf (float x)
+{
+  int64_t res;
+  asm ("fcvt.l.s %0, %1" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/riscv/rv64/rvf/s_lroundf.c b/sysdeps/riscv/rv64/rvf/s_lroundf.c
new file mode 100644
index 000000000000..010ce6904d07
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvf/s_lroundf.c
@@ -0,0 +1,31 @@
+/* lroundf().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-float.h>
+#include <stdint.h>
+
+long int
+__lroundf (float x)
+{
+  int64_t res;
+  asm ("fcvt.l.s %0, %1, rmm" : "=r" (res) : "f" (x));
+  return res;
+}
+
+libm_alias_float (__lround, lround)
diff --git a/sysdeps/riscv/rvd/e_sqrt.c b/sysdeps/riscv/rvd/e_sqrt.c
new file mode 100644
index 000000000000..66627eec21b8
--- /dev/null
+++ b/sysdeps/riscv/rvd/e_sqrt.c
@@ -0,0 +1,27 @@
+/* Double precision floating point square root.  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+
+double
+__ieee754_sqrt (double x)
+{
+  asm ("fsqrt.d %0, %1" : "=f" (x) : "f" (x));
+  return x;
+}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/riscv/rvd/s_copysign.c b/sysdeps/riscv/rvd/s_copysign.c
new file mode 100644
index 000000000000..36fef55aa276
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_copysign.c
@@ -0,0 +1,28 @@
+/* Copy sign bit between floating-point values.  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-double.h>
+
+double
+__copysign (double x, double y)
+{
+  asm ("fsgnj.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
+  return x;
+}
+libm_alias_double (__copysign, copysign)
diff --git a/sysdeps/riscv/rvd/s_finite.c b/sysdeps/riscv/rvd/s_finite.c
new file mode 100644
index 000000000000..402ae3fa3a0a
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_finite.c
@@ -0,0 +1,28 @@
+/* finite().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+
+int
+__finite (double x)
+{
+  return _FCLASS (x) & ~(_FCLASS_INF | _FCLASS_NAN);
+}
+hidden_def (__finite)
+weak_alias (__finite, finite)
diff --git a/sysdeps/riscv/rvd/s_fma.c b/sysdeps/riscv/rvd/s_fma.c
new file mode 100644
index 000000000000..165557962f18
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_fma.c
@@ -0,0 +1,30 @@
+/* Double precision floating point fused multiply-add.  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <fenv.h>
+#include <ieee754.h>
+#include <libm-alias-double.h>
+
+double
+__fma (double x, double y, double z)
+{
+  asm ("fmadd.d %0, %1, %2, %3" : "=f" (x) : "f" (x), "f" (y), "f" (z));
+  return x;
+}
+libm_alias_double (__fma, fma)
diff --git a/sysdeps/riscv/rvd/s_fmax.c b/sysdeps/riscv/rvd/s_fmax.c
new file mode 100644
index 000000000000..ef8f1344ce5a
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_fmax.c
@@ -0,0 +1,28 @@
+/* fmax().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-double.h>
+
+double
+__fmax (double x, double y)
+{
+  asm ("fmax.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
+  return x;
+}
+libm_alias_double (__fmax, fmax)
diff --git a/sysdeps/riscv/rvd/s_fmin.c b/sysdeps/riscv/rvd/s_fmin.c
new file mode 100644
index 000000000000..c6ff24cefb8a
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_fmin.c
@@ -0,0 +1,28 @@
+/* fmin().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <libm-alias-double.h>
+
+double
+__fmin (double x, double y)
+{
+  asm ("fmin.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
+  return x;
+}
+libm_alias_double (__fmin, fmin)
diff --git a/sysdeps/riscv/rvd/s_fpclassify.c b/sysdeps/riscv/rvd/s_fpclassify.c
new file mode 100644
index 000000000000..fe693c2f4a0f
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_fpclassify.c
@@ -0,0 +1,36 @@
+/* fpclassify().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+
+int
+__fpclassify (double x)
+{
+  int cls = _FCLASS (x);
+  if (__builtin_expect (cls & _FCLASS_NORM, _FCLASS_NORM))
+    return FP_NORMAL;
+  if (__builtin_expect (cls & _FCLASS_ZERO, _FCLASS_ZERO))
+    return FP_ZERO;
+  if (__builtin_expect (cls & _FCLASS_SUBNORM, _FCLASS_SUBNORM))
+    return FP_SUBNORMAL;
+  if (__builtin_expect (cls & _FCLASS_INF, _FCLASS_INF))
+    return FP_INFINITE;
+  return FP_NAN;
+}
+libm_hidden_def (__fpclassify)
diff --git a/sysdeps/riscv/rvd/s_isinf.c b/sysdeps/riscv/rvd/s_isinf.c
new file mode 100644
index 000000000000..1b9767a71839
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_isinf.c
@@ -0,0 +1,29 @@
+/* isinf().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+
+int
+__isinf (double x)
+{
+  int cls = _FCLASS (x);
+  return -((cls & _FCLASS_MINF) ? 1 : 0) | ((cls & _FCLASS_PINF) ? 1 : 0);
+}
+hidden_def (__isinf)
+weak_alias (__isinf, isinf)
diff --git a/sysdeps/riscv/rvd/s_isnan.c b/sysdeps/riscv/rvd/s_isnan.c
new file mode 100644
index 000000000000..3739de7ec78a
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_isnan.c
@@ -0,0 +1,28 @@
+/* isnan().  RISC_V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+
+int
+__isnan (double x)
+{
+  return (_FCLASS (x) & _FCLASS_NAN) != 0;
+}
+hidden_def (__isnan)
+weak_alias (__isnan, isnan)
diff --git a/sysdeps/riscv/rvd/s_issignaling.c b/sysdeps/riscv/rvd/s_issignaling.c
new file mode 100644
index 000000000000..1b65206e9af8
--- /dev/null
+++ b/sysdeps/riscv/rvd/s_issignaling.c
@@ -0,0 +1,27 @@
+/* issignaling().  RISC-V version.
+   Copyright (C) 2017-2018 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 <math.h>
+#include <math_private.h>
+
+int
+__issignaling (double x)
+{
+  return (_FCLASS (x) & _FCLASS_SNAN) != 0;
+}
+libm_hidden_def (__issignaling)
-- 
2.13.6

  parent reply	other threads:[~2018-01-25  4:37 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  4:37 RISC-V glibc port, v5 Palmer Dabbelt
2018-01-25  4:36 ` [PATCH 06/17] RISC-V: Startup and Dynamic Loading Code Palmer Dabbelt
2018-01-25 17:05   ` Joseph Myers
2018-01-25 19:55     ` Palmer Dabbelt
2018-01-25  4:36 ` [PATCH 03/17] Add support for the RISC-V-specific ELF flags Palmer Dabbelt
2018-01-25 16:51   ` Joseph Myers
2018-01-25 18:09     ` Palmer Dabbelt
2018-01-26 17:44       ` Szabolcs Nagy
2018-01-26 18:20         ` Palmer Dabbelt
2018-01-26 22:46         ` Joseph Myers
2018-01-25  4:36 ` [PATCH 01/17] Skeleton documentation for the RISC-V port Palmer Dabbelt
2018-01-25 16:50   ` Joseph Myers
2018-01-25 18:04     ` Palmer Dabbelt
2018-01-25  4:36 ` [PATCH 02/17] Add RISC-V entries to config.h.in Palmer Dabbelt
2018-01-25  4:36 ` [PATCH 04/17] Add documentation for __riscv_flush_icache Palmer Dabbelt
2018-01-25  4:37 ` Palmer Dabbelt [this message]
2018-01-25  4:37 ` [PATCH 14/17] RISC-V: Linux Startup and Dynamic Loading Code Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 17/17] Add RISC-V to build-many-glibcs.py Palmer Dabbelt
2018-01-25 17:42   ` Joseph Myers
2018-01-25 21:18     ` Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 13/17] RISC-V: Linux ABI Palmer Dabbelt
2018-01-25 17:24   ` Joseph Myers
2018-01-25 18:19     ` Adhemerval Zanella
2018-01-25 20:57     ` Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 15/17] RISC-V: Add ABI Lists Palmer Dabbelt
2018-01-25 17:26   ` Joseph Myers
2018-01-25 20:57     ` Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 08/17] RISC-V: Generic <math.h> and soft-fp Routines Palmer Dabbelt
2018-01-25 17:12   ` Joseph Myers
2018-01-25 20:57     ` Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 07/17] RISC-V: Thread-Local Storage Support Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 11/17] RISC-V: Atomic and Locking Routines Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 09/17] RISC-V: RV32F Support Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 12/17] RISC-V: Linux Syscall Interface Palmer Dabbelt
2018-01-25 17:15   ` Joseph Myers
2018-01-25 20:57     ` Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 05/17] RISC-V: ABI Implementation Palmer Dabbelt
2018-01-25  4:37 ` [PATCH 16/17] RISC-V: Build Infastructure Palmer Dabbelt
2018-01-25  9:35 ` RISC-V glibc port, v5 Andreas Schwab
2018-01-25 16:33   ` Palmer Dabbelt
2018-01-25 18:01   ` Joseph Myers
2018-01-25 11:47 ` Darius Rad
2018-01-25 16:44 ` Joseph Myers
2018-01-25 16:52   ` DJ Delorie
2018-01-25 17:06     ` Joseph Myers
2018-01-25 19:01       ` Jim Wilson
2018-01-25 20:27         ` Joseph Myers
2018-01-25 17:08     ` Andreas Schwab
2018-01-25 18:04   ` Palmer Dabbelt
2018-01-25 18:37     ` Joseph Myers
2018-01-26  2:58       ` Palmer Dabbelt
2018-01-25 17:06 ` DJ Delorie
2018-01-25 17:58 ` Joseph Myers
2018-01-25 19:59   ` Richard W.M. Jones
2018-01-25 20:52     ` Joseph Myers
2018-01-26  3:44       ` Palmer Dabbelt
2018-01-26  2:59     ` Palmer Dabbelt
2018-01-25 20:32   ` Joseph Myers
2018-01-26  3:44     ` Palmer Dabbelt
2018-01-26 12:37       ` Joseph Myers
2018-01-26 17:51         ` Palmer Dabbelt
2018-01-26  2:58   ` [patches] " Palmer Dabbelt
2018-01-26 12:32     ` Joseph Myers

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=20180125043621.19972-11-palmer@dabbelt.com \
    --to=palmer@dabbelt.com \
    --cc=andrew@sifive.com \
    --cc=darius@bluespec.com \
    --cc=dj@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=patches@groups.riscv.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).