[RFC PATCH 1/5] riscv: libmvec: add RVV log and infrastructure

Yao Zihong zihong.plct@isrc.iscas.ac.cn
Sun Feb 8 22:04:36 GMT 2026


From: Zihong Yao <zihong.plct@isrc.iscas.ac.cn>

Add the initial RVV libmvec for RISC-V and wire it into the mathvec build
and symbol exports.

Provide the RVV variant list and importer glue plus a double-precision
log implementation/data/skeleton.

Move ptr_barrier to generic/math_private.h so it is shared by the new RVV code.

The vector log implementation is derived from veclibm:
https://github.com/rivosinc/veclibm

Signed-off-by: Zihong Yao <zihong.plct@isrc.iscas.ac.cn>
Co-authored-by: Yulong Shi <shiyulong@iscas.ac.cn>
Co-authored-by: Zhijin Zeng <zhijin.zeng@spacemit.com>
---
 sysdeps/aarch64/fpu/vecmath_config.h          |   9 -
 sysdeps/generic/math_private.h                |   9 +
 sysdeps/riscv/rvd/Makeconfig                  |  33 ++++
 sysdeps/riscv/rvd/Makefile                    |  25 +++
 sysdeps/riscv/rvd/Versions                    |  15 ++
 sysdeps/riscv/rvd/bits/math-vector.h          |  25 +++
 sysdeps/riscv/rvd/v_d_log.c                   |  22 +++
 sysdeps/riscv/rvd/v_d_log_data.c              | 152 ++++++++++++++++
 sysdeps/riscv/rvd/v_d_log_skeleton.c          | 151 ++++++++++++++++
 sysdeps/riscv/rvd/v_math.h                    | 169 ++++++++++++++++++
 sysdeps/riscv/rvd/v_math_importer.h           | 137 ++++++++++++++
 sysdeps/riscv/rvd/v_math_names.h              |  27 +++
 sysdeps/riscv/rvd/v_math_variants.h           |  48 +++++
 sysdeps/riscv/rvd/vecmath_config.h            | 110 ++++++++++++
 sysdeps/unix/sysv/linux/riscv/libmvec.abilist |  11 ++
 15 files changed, 934 insertions(+), 9 deletions(-)
 create mode 100644 sysdeps/riscv/rvd/Makeconfig
 create mode 100644 sysdeps/riscv/rvd/Makefile
 create mode 100644 sysdeps/riscv/rvd/Versions
 create mode 100644 sysdeps/riscv/rvd/bits/math-vector.h
 create mode 100644 sysdeps/riscv/rvd/v_d_log.c
 create mode 100644 sysdeps/riscv/rvd/v_d_log_data.c
 create mode 100644 sysdeps/riscv/rvd/v_d_log_skeleton.c
 create mode 100644 sysdeps/riscv/rvd/v_math.h
 create mode 100644 sysdeps/riscv/rvd/v_math_importer.h
 create mode 100644 sysdeps/riscv/rvd/v_math_names.h
 create mode 100644 sysdeps/riscv/rvd/v_math_variants.h
 create mode 100644 sysdeps/riscv/rvd/vecmath_config.h
 create mode 100644 sysdeps/unix/sysv/linux/riscv/libmvec.abilist

diff --git a/sysdeps/aarch64/fpu/vecmath_config.h b/sysdeps/aarch64/fpu/vecmath_config.h
index b75f09e5f1..244d188b73 100644
--- a/sysdeps/aarch64/fpu/vecmath_config.h
+++ b/sysdeps/aarch64/fpu/vecmath_config.h
@@ -21,15 +21,6 @@
 
 #include <math_private.h>
 
-/* Return ptr but hide its value from the compiler so accesses through it
-   cannot be optimized based on the contents.  */
-#define ptr_barrier(ptr)                                                      \
-  ({                                                                          \
-    __typeof (ptr) __ptr = (ptr);                                             \
-    __asm("" : "+r"(__ptr));                                                  \
-    __ptr;                                                                    \
-  })
-
 #define V_LOG_POLY_ORDER 6
 #define V_LOG_TABLE_BITS 7
 extern const struct v_log_data
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 3865dcf905..811cfd80f2 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -200,4 +200,13 @@ extern double __sin (double __x);
 extern double __cos (double __x);
 extern int __branred (double __x, double *__a, double *__aa);
 
+/* Return ptr but hide its value from the compiler so accesses through it
+   cannot be optimized based on the contents.  */
+#define ptr_barrier(ptr)                                                      \
+  ({                                                                          \
+    __typeof (ptr) __ptr = (ptr);                                             \
+    __asm("" : "+r"(__ptr));                                                  \
+    __ptr;                                                                    \
+  })
+
 #endif /* _MATH_PRIVATE_H_ */
diff --git a/sysdeps/riscv/rvd/Makeconfig b/sysdeps/riscv/rvd/Makeconfig
new file mode 100644
index 0000000000..56f63a5d01
--- /dev/null
+++ b/sysdeps/riscv/rvd/Makeconfig
@@ -0,0 +1,33 @@
+# Generate libmvec.mk for libmvec.
+
+# Copyright (C) 2026 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
+# <https://www.gnu.org/licenses/>.
+
+-include $(common-objpfx)libmvec.mk
+postclean-generated += libmvec.mk
+
+libmvec-float-funcs-bare = \
+
+libmvec-float-funcs-with-data = \
+
+libmvec-double-funcs-bare = \
+
+libmvec-double-funcs-with-data = \
+  log        \
+
+libmvec-float-funcs = $(libmvec-float-funcs-bare) $(libmvec-float-funcs-with-data)
+libmvec-double-funcs = $(libmvec-double-funcs-bare) $(libmvec-double-funcs-with-data)
diff --git a/sysdeps/riscv/rvd/Makefile b/sysdeps/riscv/rvd/Makefile
new file mode 100644
index 0000000000..05cd793906
--- /dev/null
+++ b/sysdeps/riscv/rvd/Makefile
@@ -0,0 +1,25 @@
+ifeq ($(subdir),mathvec)
+
+libmvec-sysdep_routines = \
+	$(addprefix $(libmvec-vprefix)v_d_, $(libmvec-double-funcs)) \
+	$(addsuffix _data, $(addprefix v_d_, $(libmvec-double-funcs-with-data))) \
+	$(addprefix v_f_, $(libmvec-float-funcs)) \
+	$(addsuffix _data, $(addprefix v_f_, $(libmvec-float-funcs-with-data))) \
+
+define riscv64-vector-cflags-template
+CFLAGS-$(1).c += -march=rv64gcv -Wno-maybe-uninitialized -Wno-undef
+endef
+
+define riscv32-vector-cflags-template
+CFLAGS-$(1).c += -march=rv32gcv -Wno-maybe-uninitialized -Wno-undef
+endef
+
+ifeq ($(config-machine),riscv64)
+$(foreach f,$(libmvec-sysdep_routines), $(eval $(call riscv64-vector-cflags-template,$(f))))
+endif
+
+ifeq ($(config-machine),riscv32)
+$(foreach f,$(libmvec-sysdep_routines), $(eval $(call riscv32-vector-cflags-template,$(f))))
+endif
+
+endif
diff --git a/sysdeps/riscv/rvd/Versions b/sysdeps/riscv/rvd/Versions
new file mode 100644
index 0000000000..9d43e652a9
--- /dev/null
+++ b/sysdeps/riscv/rvd/Versions
@@ -0,0 +1,15 @@
+libmvec {
+  GLIBC_2.43 {
+    _ZGVr1N2v_log;
+    _ZGVr1N4v_log;
+    _ZGVr2N2v_log;
+    _ZGVr2N4v_log;
+    _ZGVr2N8v_log;
+    _ZGVr4N4v_log;
+    _ZGVr4N8v_log;
+    _ZGVr4N16v_log;
+    _ZGVr8N8v_log;
+    _ZGVr8N16v_log;
+    _ZGVr8N32v_log;
+  }
+}
diff --git a/sysdeps/riscv/rvd/bits/math-vector.h b/sysdeps/riscv/rvd/bits/math-vector.h
new file mode 100644
index 0000000000..29c55c3e35
--- /dev/null
+++ b/sysdeps/riscv/rvd/bits/math-vector.h
@@ -0,0 +1,25 @@
+/* Platform-specific SIMD declarations of math functions.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _MATH_H
+#  error "Never include <bits/math-vector.h> directly;\
+ include <math.h> instead."
+#endif
+
+/* Use the default empty SIMD declaration stubs unless overridden.  */
+#include <bits/libm-simd-decl-stubs.h>
diff --git a/sysdeps/riscv/rvd/v_d_log.c b/sysdeps/riscv/rvd/v_d_log.c
new file mode 100644
index 0000000000..9462db7964
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_d_log.c
@@ -0,0 +1,22 @@
+/* Double-precision vector log function.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#define LIBMVEC_TYPE double
+#define LIBMVEC_FUNC log
+#define LIBMVEC_IMPL "v_d_log_skeleton.c"
+#include "v_math_importer.h"
diff --git a/sysdeps/riscv/rvd/v_d_log_data.c b/sysdeps/riscv/rvd/v_d_log_data.c
new file mode 100644
index 0000000000..ffcc42e2ac
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_d_log_data.c
@@ -0,0 +1,152 @@
+/* Data table for double-precision vector log function.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdint.h>
+#include <vecmath_config.h>
+
+const struct v_log_data __v_log_data = {
+  .table = {0x0,
+            0x22d443c414148a1,
+            0x3a475f892273f13,
+            0x51ea81cd5dc13cb,
+            0x69be70ddf74c6a8,
+            0x81c3f7de5434ed0,
+            0x8dd9953002a4e86,
+            0xa62b07f3457c407,
+            0xbeb024b67dda634,
+            0xd769c8d5b33a728,
+            0xe3da945b878e27d,
+            0xfce4aee0e88b275,
+            0x1162593186da6fc4,
+            0x122dadc2ab3496d3,
+            0x13c6fb650cde50a1,
+            0x1563dc29ffacb20d,
+            0x1633a8bf437ce10b,
+            0x17d60496cfbb4c67,
+            0x18a8980abfbd3266,
+            0x1a5094b54d282840,
+            0x1b2602497d53458d,
+            0x1cd3c712d3110932,
+            0x1dac22d3e441d2fe,
+            0x1f5fd8a9063e3491,
+            0x203b3779f4c3a8bb,
+            0x21f509008966a211,
+            0x22d380a6c7e2b0e4,
+            0x23b30593aa4e106c,
+            0x2575418697c3d7e0,
+            0x2657fdc6e1dcd0cb,
+            0x273bd1c2ab3edefe,
+            0x2906cbcd2baf2d54,
+            0x29edf7659d8b30f2,
+            0x2ad645cd6af1c939,
+            0x2bbfb9e3dd5c1c88,
+            0x2d961ed0cb91d407,
+            0x2e83159d77e31d6d,
+            0x2f713e059e555a64,
+            0x30609b21823fa654,
+            0x315130157f7a64cd,
+            0x33360e552d8d64de,
+            0x342a5e28530367af,
+            0x351ff2e30214bc30,
+            0x3616cfe9e8d01fea,
+            0x370ef8af6360dfe0,
+            0x380870b3c5fb66f7,
+            0x39033b85a8bfc871,
+            0x39ff5cc235a256c5,
+            0x3afcd815786af188,
+            0x3bfbb13ab0dc5614,
+            0x3cfbebfca715669e,
+            0x3dfd8c36023f0ab7,
+            0x3f0095d1a19a0332,
+            0x40050ccaf800ca8c,
+            0x410af52e69f26264,
+            0x42125319ae3bbf06,
+            0x431b2abc31565be7,
+            0x442580577b936763,
+            0x4531583f9a2be204,
+            0x463eb6db8b4f066d,
+            0x474da0a5ad495303,
+            0x485e1a2c30df9ea9,
+            0x497028118efabeb8,
+            0x4a83cf0d01c16e3d,
+            -0x3466ec14fec0a13b,
+            -0x335004723c465e69,
+            -0x323775123e2e1169,
+            -0x323775123e2e1169,
+            -0x311d38e5c1644b49,
+            -0x30014ac62c38a865,
+            -0x2ee3a574fdf677c9,
+            -0x2dc4439b3a19bcaf,
+            -0x2ca31fc8cef74dca,
+            -0x2ca31fc8cef74dca,
+            -0x2b803473f7ad0f3f,
+            -0x2a5b7bf8992d66fc,
+            -0x2934f0979a3715fd,
+            -0x280c8c76360892eb,
+            -0x280c8c76360892eb,
+            -0x26e2499d499bd9b3,
+            -0x25b621f89b355ede,
+            -0x24880f561c0e7305,
+            -0x24880f561c0e7305,
+            -0x23580b6523e0e0a5,
+            -0x22260fb5a616eb96,
+            -0x20f215b7606012de,
+            -0x20f215b7606012de,
+            -0x1fbc16b902680a24,
+            -0x1e840be74e6a4cc8,
+            -0x1e840be74e6a4cc8,
+            -0x1d49ee4c32596fc9,
+            -0x1c0db6cdd94dee41,
+            -0x1c0db6cdd94dee41,
+            -0x1acf5e2db4ec93f0,
+            -0x198edd077e70df03,
+            -0x198edd077e70df03,
+            -0x184c2bd02f03b2fe,
+            -0x170742d4ef027f2a,
+            -0x170742d4ef027f2a,
+            -0x15c01a39fbd687a0,
+            -0x1476a9f983f74d31,
+            -0x1476a9f983f74d31,
+            -0x132ae9e278ae1a1f,
+            -0x132ae9e278ae1a1f,
+            -0x11dcd197552b7b5f,
+            -0x108c588cda79e396,
+            -0x108c588cda79e396,
+            -0xf397608bfd2d90e,
+            -0xf397608bfd2d90e,
+            -0xde4212056d5dd32,
+            -0xc8c50b72319ad57,
+            -0xc8c50b72319ad57,
+            -0xb31fb7d64898b3e,
+            -0xb31fb7d64898b3e,
+            -0x9d517ee93f8e16c,
+            -0x9d517ee93f8e16c,
+            -0x8759c4fd14fcd5a,
+            -0x7137eae42aad7bd,
+            -0x7137eae42aad7bd,
+            -0x5aeb4dd63bf61cc,
+            -0x5aeb4dd63bf61cc,
+            -0x447347544cd04bb,
+            -0x447347544cd04bb,
+            -0x2dcf2d0b85a4531,
+            -0x2dcf2d0b85a4531,
+            -0x16fe50b6ef08518,
+            -0x16fe50b6ef08518,
+            0x0
+           }
+};
diff --git a/sysdeps/riscv/rvd/v_d_log_skeleton.c b/sysdeps/riscv/rvd/v_d_log_skeleton.c
new file mode 100644
index 0000000000..f8b3213df5
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_d_log_skeleton.c
@@ -0,0 +1,151 @@
+/* Double-precision vector log function.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <vecmath_config.h>
+#include <v_math.h>
+
+#ifndef RVV_LIBMVEC_IMPL_NAME
+# error "RVV_LIBMVEC_IMPL_NAME must be defined for RVV libmvec skeleton"
+#endif
+#ifndef V_MATH_FUNC
+# error "V_MATH_FUNC must be defined for RVV libmvec skeleton"
+#endif
+
+#ifndef V_D_LOG_SKELETON_ONCE
+#define V_D_LOG_SKELETON_ONCE
+
+#define LOGB_2_HI 0x1.62e42fefa39efp-1
+#define LOGB_2_LO 0x1.abc9e3b39803fp-56
+
+#endif
+
+static VFLOAT
+RVV_LIBMVEC_IMPL_NAME (V_MATH_FUNC, LMUL) (VFLOAT x, size_t vlen)
+{
+  const struct v_log_data *d = ptr_barrier(&__v_log_data);
+  VFLOAT vx, vy, vy_special;
+  VBOOL special_args;
+  VINT n_adjust;
+
+  SET_ROUNDTONEAREST;
+  /* stripmining over input arguments: vlen chosen by wrapper */
+  vx = x;
+
+  /* NaN, Inf, and -ve handling, as well as scaling denormal input by 2^64
+   */
+  VUINT vclass = __riscv_vfclass((vx), (vlen));
+  /* special handling except positive normal number */
+  IDENTIFY(vclass, 0x3BF, (special_args), (vlen));
+  UINT nb_special_args = __riscv_vcpop((special_args), (vlen));
+  n_adjust = VMVI_VX(0, (vlen));
+  if (nb_special_args > 0)
+    {
+      VBOOL id_mask;
+      /* substitute negative arguments with sNaN */
+      IDENTIFY(vclass, class_negative, id_mask, (vlen));
+      vx = VFMERGE_VFM(vx, fp_sNaN, id_mask, vlen);
+      /* substitute +0 argument with -0 */
+      IDENTIFY(vclass, class_posZero, id_mask, vlen);
+      vx = VFMERGE_VFM(vx, fp_negZero, id_mask, vlen);
+      /* eliminate positive denorm input from special_args */
+      IDENTIFY(vclass, 0x39F, (special_args), (vlen));
+      /* for narrowed set of special arguments, compute vx+vfrec7(vx) */
+      vy_special = VFREC7_M((special_args), (vx), (vlen));
+      vy_special
+          = VFADD_VV_M((special_args), vy_special, (vx), (vlen));
+      vx = VFMERGE_VFM((vx), fp_posOne, (special_args), (vlen));
+      /* scale up input for positive denormals */
+      IDENTIFY(vclass, class_posDenorm, id_mask, (vlen));
+      n_adjust = VMERGE_VXM_I(n_adjust, 64, id_mask, vlen);
+      VFLOAT vx_normalized = VFMUL_VF_M(id_mask, vx, 0x1.0p64, vlen);
+      vx = VMERGE_VVM_F(vx, vx_normalized, id_mask, vlen);
+    }
+
+  /* in_arg at this point are positive, finite and not subnormal
+     Decompose in_arg into n, B, r: in_arg = 2^n (1/B) (1 + r)
+     B is equivalently defined by ind, 0 <= ind < 128 */
+  VINT n = U_AS_I(__riscv_vadd(
+      __riscv_vsrl(F_AS_U (vx), MAN_LEN - 1, vlen), 1, vlen));
+  n = __riscv_vsra(n, 1, vlen);
+  n = __riscv_vsub(n, EXP_BIAS, vlen);
+  vx = U_AS_F(
+      __riscv_vsrl(__riscv_vsll (F_AS_U (vx), BIT_WIDTH - MAN_LEN, vlen),
+                    BIT_WIDTH - MAN_LEN, vlen));
+  vx = U_AS_F(
+      __riscv_vadd (F_AS_U (vx), (uint64_t)EXP_BIAS << MAN_LEN, vlen));
+  n = __riscv_vsub (n, n_adjust, vlen);
+  VFLOAT n_flt = __riscv_vfcvt_f(n, vlen);
+  VFLOAT B = __riscv_vfrec7(vx, vlen);
+  /* get 7 msb of mantissa, and left shift by 3 to get address */
+  VUINT ind = __riscv_vand(__riscv_vsrl (F_AS_U (vx), MAN_LEN - 10, vlen),
+                            0x3F8, vlen);
+  /* adjust B to be 1.0 if ind == 0 */
+  VBOOL adjust_B = __riscv_vmseq(ind, 0, vlen);
+  B = VFMERGE_VFM(B, fp_posOne, adjust_B, vlen);
+  /* finally get r = B * in_arg - 1.0 */
+  VFLOAT r = VFMV_VF(fp_posOne, vlen);
+  r = __riscv_vfmsac(r, vx, B, vlen);
+
+  /* Base-B log is logB(in_arg) = logB(2^n * 1/B) + logB(1 + r)
+     (n + log2(1/B))*logB(2) + log(1+r)*logB(e)
+     log2(1/B) is stored in a table
+     and log(1+r) is approximated by r + poly
+     poly is a polynomial in r in the form r^2 * (p0 + p1 r + ... )
+     To deliver this result accurately, one uses logB(2) and logB(e)
+     with extra precision and sums the various terms in an appropriate
+     order */
+  VFLOAT rsq = __riscv_vfmul(r, r, vlen);
+  VFLOAT rcube = __riscv_vfmul(rsq, r, vlen);
+
+  VFLOAT poly_right = PSTEP(
+      0x1.9999998877038p-3, r,
+      PSTEP(-0x1.555c54f8b7c6cp-3, 0x1.2499765b3c27ap-3, r, vlen), vlen);
+
+  VFLOAT poly_left = PSTEP(
+      -0x1.000000000001cp-1, r,
+      PSTEP(0x1.55555555555a9p-2, -0x1.fffffff2018cfp-3, r, vlen), vlen);
+
+  VFLOAT poly = __riscv_vfmadd(poly_right, rcube, poly_left, vlen);
+  poly = __riscv_vfmul(rsq, poly, vlen);
+  /* log_e(1+r) is r + poly */
+
+  /* Load table values and get n_flt + T to be A + a */
+  VINT T = __riscv_vluxei64(d->table, ind, vlen);
+  VINT T_hi = __riscv_vsll(__riscv_vsra (T, 24, vlen), 24, vlen);
+  VINT T_lo = __riscv_vsub(T, T_hi, vlen);
+  VFLOAT T_hi_flt = __riscv_vfcvt_f(T_hi, vlen);
+  VFLOAT A = __riscv_vfmadd(T_hi_flt, 0x1.0p-63, n_flt, vlen);
+  VFLOAT a = __riscv_vfcvt_f(T_lo, vlen);
+  a = __riscv_vfmul (a, 0x1.0p-63, vlen);
+
+  /* Compute (A + a) * (logB_2_hi + logB_2_lo) + (r + P) * (logB_e_hi +
+     logB_e_lo) */
+  VFLOAT delta_1 = __riscv_vfmul(A, LOGB_2_LO, vlen);
+  delta_1 = __riscv_vfmadd(a, LOGB_2_HI, delta_1, vlen);
+  poly = __riscv_vfadd(poly, delta_1, vlen);
+
+  poly = __riscv_vfadd(poly, r, vlen);
+
+  vy = __riscv_vfmadd(A, LOGB_2_HI, poly, vlen);
+  vy = VMERGE_VVM_F(vy, vy_special, special_args, vlen);
+
+  RESTORE_FRM;
+  return vy;
+}
+
+#undef LMUL
diff --git a/sysdeps/riscv/rvd/v_math.h b/sysdeps/riscv/rvd/v_math.h
new file mode 100644
index 0000000000..5b00267ada
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_math.h
@@ -0,0 +1,169 @@
+/* Utilities for RVV libmvec routines.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _V_MATH_H
+#define _V_MATH_H
+
+#include <riscv_vector.h>
+#include <math_private.h>
+#include <assert.h>
+
+#include <v_math_names.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#define _NEED_UNDEF_GNU_SOURCE_V_MATH
+#endif
+
+#include <math.h>
+#ifndef NAN
+_Static_assert (0, "NaN not available on this architecture");
+#endif
+
+#define __PASTE2_BASE(A, B) A##B
+#define __PASTE2(A, B) __PASTE2_BASE (A, B)
+#define __PASTE3_BASE(A, B, C) A##B##C
+#define __PASTE3(A, B, C) __PASTE3_BASE (A, B, C)
+#define __PASTE4_BASE(A, B, C, D) A##B##C##D
+#define __PASTE4(A, B, C, D) __PASTE4_BASE (A, B, C, D)
+#define __PASTE5_BASE(A, B, C, D, E) A##B##C##D##E
+#define __PASTE5(A, B, C, D, E) __PASTE5_BASE (A, B, C, D, E)
+static const uint64_t class_posZero = 0x10;
+static const uint64_t class_posDenorm = 0x20;
+static const uint64_t class_negative = 0x7;
+
+#ifdef _NEED_UNDEF_GNU_SOURCE_V_MATH
+#undef _GNU_SOURCE
+#undef _NEED_UNDEF_GNU_SOURCE_V_MATH
+#endif
+
+#endif
+
+#ifndef LMUL
+# error "Must assign an LMUL before including v_math.h"
+#endif
+#ifndef BIT_WIDTH
+# error "Must assign BIT_WIDTH before including v_math.h"
+#endif
+
+/* Undefine previous LMUL-dependent macros to allow redefinition */
+#undef MAKE_VTYPE
+#undef MAKE_TYPE
+#undef MAKE_FUNC
+#undef MAKE_VBOOL
+#undef VSET
+#undef MAKE_REINTERPRET
+#undef FLOAT
+#undef VFLOAT
+#undef INT
+#undef VINT
+#undef UINT
+#undef VUINT
+#undef VBOOL
+#undef F_AS_I
+#undef F_AS_U
+#undef I_AS_F
+#undef U_AS_F
+#undef I_AS_U
+#undef U_AS_I
+#undef VMVI_VX
+#undef VFMV_VF
+#undef EXP_BIAS
+#undef MAN_LEN
+
+#define MAKE_VTYPE(A) __PASTE3 (A, BIT_WIDTH, __PASTE3 (m, LMUL, _t))
+#define MAKE_TYPE(A) __PASTE3 (A, BIT_WIDTH, _t)
+#define MAKE_FUNC(A) __PASTE3 (A, BIT_WIDTH, __PASTE2 (m, LMUL))
+
+#if (BIT_WIDTH == 64)
+# define EXP_BIAS 1023
+# define MAN_LEN 52
+# ifndef _V_MATH_SCALAR_64
+#  define _V_MATH_SCALAR_64
+typedef double scalar_t;
+static const scalar_t fp_sNaN = __builtin_nans ("");
+static const scalar_t fp_negZero = -0.;
+static const scalar_t fp_posZero = 0.0;
+static const scalar_t fp_posOne = 0x1.0p0;
+# endif
+#elif (BIT_WIDTH == 32)
+# define EXP_BIAS 127
+# define MAN_LEN 23
+# ifndef _V_MATH_SCALAR_32
+#  define _V_MATH_SCALAR_32
+typedef float scalar_t;
+static const scalar_t fp_sNaN = __builtin_nansf ("");
+static const scalar_t fp_negZero = -0.f;
+static const scalar_t fp_posZero = 0.0f;
+static const scalar_t fp_posOne = 0x1.0p0f;
+# endif
+#else
+# error "requested BIT_WIDTH unsupported"
+#endif
+
+/* For MAKE_VBOOL, the value is BIT_WIDTH/LMUL for the current element size. */
+#if (BIT_WIDTH == 64)
+# if (LMUL == 1)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 64, _t)
+# elif (LMUL == 2)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 32, _t)
+# elif (LMUL == 4)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 16, _t)
+# elif (LMUL == 8)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 8, _t)
+# else
+#  error "requested LMUL unsupported"
+# endif
+#elif (BIT_WIDTH == 32)
+# if (LMUL == 1)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 32, _t)
+# elif (LMUL == 2)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 16, _t)
+# elif (LMUL == 4)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 8, _t)
+# elif (LMUL == 8)
+#  define MAKE_VBOOL(A) __PASTE3 (A, 4, _t)
+# else
+#  error "requested LMUL unsupported"
+# endif
+#else
+# error "requested BIT_WIDTH unsupported"
+#endif
+
+#define VSET __PASTE2 (__riscv_vsetvl_e, __PASTE3 (BIT_WIDTH, m, LMUL))
+#define MAKE_REINTERPRET(A, B)                                                \
+  __PASTE5 (__riscv_vreinterpret_v_, A, __PASTE4 (BIT_WIDTH, m, LMUL, _), B,  \
+            __PASTE3 (BIT_WIDTH, m, LMUL))
+
+#define FLOAT MAKE_TYPE (float)
+#define VFLOAT MAKE_VTYPE (vfloat)
+#define INT MAKE_TYPE (int)
+#define VINT MAKE_VTYPE (vint)
+#define UINT MAKE_TYPE (uint)
+#define VUINT MAKE_VTYPE (vuint)
+#define VBOOL MAKE_VBOOL (vbool)
+
+#define F_AS_I MAKE_REINTERPRET (f, i)
+#define F_AS_U MAKE_REINTERPRET (f, u)
+#define I_AS_F MAKE_REINTERPRET (i, f)
+#define U_AS_F MAKE_REINTERPRET (u, f)
+#define I_AS_U MAKE_REINTERPRET (i, u)
+#define U_AS_I MAKE_REINTERPRET (u, i)
+
+#define VMVI_VX MAKE_FUNC (__riscv_vmv_v_x_i)
+#define VFMV_VF MAKE_FUNC (__riscv_vfmv_v_f_f)
diff --git a/sysdeps/riscv/rvd/v_math_importer.h b/sysdeps/riscv/rvd/v_math_importer.h
new file mode 100644
index 0000000000..385ab04f2e
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_math_importer.h
@@ -0,0 +1,137 @@
+/* RVV libmvec implementation importer.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <v_math_variants.h>
+
+#ifndef LIBMVEC_TYPE
+# error "LIBMVEC_TYPE must be defined for RVV libmvec import"
+#endif
+#ifndef LIBMVEC_FUNC
+# error "LIBMVEC_FUNC must be defined for RVV libmvec import"
+#endif
+#ifndef LIBMVEC_IMPL
+# error "LIBMVEC_IMPL must be defined for RVV libmvec import"
+#endif
+
+#define RVV_LIBMVEC_IS_VALID_TYPE_double 1
+#define RVV_LIBMVEC_IS_VALID_TYPE_float 1
+#define RVV_LIBMVEC_IS_VALID_TYPE_INNER(t) RVV_LIBMVEC_IS_VALID_TYPE_##t
+#define RVV_LIBMVEC_IS_VALID_TYPE(t) RVV_LIBMVEC_IS_VALID_TYPE_INNER (t)
+
+#if !RVV_LIBMVEC_IS_VALID_TYPE (LIBMVEC_TYPE)
+# error "Unsupported LIBMVEC_TYPE for RVV libmvec import (expected float or double)"
+#endif
+
+#define RVV_LIBMVEC_IS_DOUBLE_double 1
+#define RVV_LIBMVEC_IS_DOUBLE_float 0
+#define RVV_LIBMVEC_IS_DOUBLE_INNER(t) RVV_LIBMVEC_IS_DOUBLE_##t
+#define RVV_LIBMVEC_IS_DOUBLE(t) RVV_LIBMVEC_IS_DOUBLE_INNER (t)
+
+#define RVV_LIBMVEC_BIT_WIDTH_double 64
+#define RVV_LIBMVEC_BIT_WIDTH_float 32
+#define RVV_LIBMVEC_BIT_WIDTH_INNER(t) RVV_LIBMVEC_BIT_WIDTH_##t
+#define RVV_LIBMVEC_BIT_WIDTH(t) RVV_LIBMVEC_BIT_WIDTH_INNER (t)
+
+#define BIT_WIDTH RVV_LIBMVEC_BIT_WIDTH (LIBMVEC_TYPE)
+
+/* Internal function naming and wrapper helpers.  */
+#if RVV_LIBMVEC_IS_DOUBLE (LIBMVEC_TYPE)
+
+# define RVV_LIBMVEC_IMPL_NAME_INNER(fun, lmul)                             \
+  __rvv_##fun##_w64_m##lmul##_impl
+# define RVV_LIBMVEC_IMPL_NAME(fun, lmul)                                   \
+  RVV_LIBMVEC_IMPL_NAME_INNER (fun, lmul)
+
+# define RVV_LIBMVEC_VFLOAT(lmul) vfloat64m##lmul##_t
+# define RVV_LIBMVEC_VSETVL(lmul) __riscv_vsetvl_e64m##lmul
+
+# define RVV_LIBMVEC_VARIANTS(X) RVV_LIBMVEC_VARIANTS_F64 (X)
+
+#else
+
+# define RVV_LIBMVEC_IMPL_NAME_INNER(fun, lmul)                             \
+  __rvv_##fun##_w32_m##lmul##_impl
+# define RVV_LIBMVEC_IMPL_NAME(fun, lmul)                                   \
+  RVV_LIBMVEC_IMPL_NAME_INNER (fun, lmul)
+
+# define RVV_LIBMVEC_VFLOAT(lmul) vfloat32m##lmul##_t
+# define RVV_LIBMVEC_VSETVL(lmul) __riscv_vsetvl_e32m##lmul
+
+# define RVV_LIBMVEC_VARIANTS(X) RVV_LIBMVEC_VARIANTS_F32 (X)
+
+#endif
+
+/* Macros used by the skeleton implementation.  */
+#define V_MATH_FUNC LIBMVEC_FUNC
+#define V_MATH_IMPL LIBMVEC_IMPL
+
+/* Instantiate the skeleton once per LMUL (the wrapper controls vlen).  */
+#undef LMUL
+#define LMUL 1
+#include V_MATH_IMPL
+
+#undef LMUL
+#define LMUL 2
+#include V_MATH_IMPL
+
+#undef LMUL
+#define LMUL 4
+#include V_MATH_IMPL
+
+#undef LMUL
+#define LMUL 8
+#include V_MATH_IMPL
+
+/* Exported wrappers for each LMUL/SIMDLEN pair.  */
+#define RVV_LIBMVEC_DEFINE_WRAPPER(lmul, simdlen)                           \
+  RVV_LIBMVEC_VFLOAT (lmul)                                                 \
+  V_NAME_D1 (lmul, simdlen, V_MATH_FUNC) (RVV_LIBMVEC_VFLOAT (lmul) x)      \
+  {                                                                         \
+    size_t vlen = RVV_LIBMVEC_VSETVL (lmul) (simdlen);                      \
+    return RVV_LIBMVEC_IMPL_NAME (V_MATH_FUNC, lmul) (x, vlen);             \
+  }
+
+#define X(lmul, simdlen) RVV_LIBMVEC_DEFINE_WRAPPER (lmul, simdlen)
+RVV_LIBMVEC_VARIANTS (X)
+#undef X
+
+#undef RVV_LIBMVEC_DEFINE_WRAPPER
+#undef RVV_LIBMVEC_VARIANTS
+#undef RVV_LIBMVEC_VSETVL
+#undef RVV_LIBMVEC_VFLOAT
+#undef RVV_LIBMVEC_IMPL_NAME
+#undef RVV_LIBMVEC_IMPL_NAME_INNER
+
+#undef V_MATH_IMPL
+#undef V_MATH_FUNC
+
+#undef BIT_WIDTH
+#undef RVV_LIBMVEC_BIT_WIDTH
+#undef RVV_LIBMVEC_BIT_WIDTH_INNER
+#undef RVV_LIBMVEC_BIT_WIDTH_double
+#undef RVV_LIBMVEC_BIT_WIDTH_float
+
+#undef RVV_LIBMVEC_IS_DOUBLE
+#undef RVV_LIBMVEC_IS_DOUBLE_INNER
+#undef RVV_LIBMVEC_IS_DOUBLE_double
+#undef RVV_LIBMVEC_IS_DOUBLE_float
+
+#undef RVV_LIBMVEC_IS_VALID_TYPE
+#undef RVV_LIBMVEC_IS_VALID_TYPE_INNER
+#undef RVV_LIBMVEC_IS_VALID_TYPE_double
+#undef RVV_LIBMVEC_IS_VALID_TYPE_float
diff --git a/sysdeps/riscv/rvd/v_math_names.h b/sysdeps/riscv/rvd/v_math_names.h
new file mode 100644
index 0000000000..c83b7abc15
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_math_names.h
@@ -0,0 +1,27 @@
+/* RVV libmvec name helpers.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef V_MATH_NAMES_H
+#define V_MATH_NAMES_H
+
+#ifndef V_NAME_D1
+# define V_NAME_D1_INNER(lmul, simdlen, fun) _ZGVr##lmul##N##simdlen##v_##fun
+# define V_NAME_D1(lmul, simdlen, fun) V_NAME_D1_INNER (lmul, simdlen, fun)
+#endif
+
+#endif
diff --git a/sysdeps/riscv/rvd/v_math_variants.h b/sysdeps/riscv/rvd/v_math_variants.h
new file mode 100644
index 0000000000..6862337ad0
--- /dev/null
+++ b/sysdeps/riscv/rvd/v_math_variants.h
@@ -0,0 +1,48 @@
+/* RVV libmvec LMUL/SIMDLEN variants.
+   Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef V_MATH_VARIANTS_H
+#define V_MATH_VARIANTS_H
+
+#define RVV_LIBMVEC_VARIANTS_F64(X)                                          \
+  X (1, 2)                                                                   \
+  X (1, 4)                                                                   \
+  X (2, 2)                                                                   \
+  X (2, 4)                                                                   \
+  X (2, 8)                                                                   \
+  X (4, 4)                                                                   \
+  X (4, 8)                                                                   \
+  X (4, 16)                                                                  \
+  X (8, 8)                                                                   \
+  X (8, 16)                                                                  \
+  X (8, 32)
+
+#define RVV_LIBMVEC_VARIANTS_F32(X)                                          \
+  X (1, 4)                                                                   \
+  X (1, 8)                                                                   \
+  X (2, 4)                                                                   \
+  X (2, 8)                                                                   \
+  X (2, 16)                                                                  \
+  X (4, 8)                                                                   \
+  X (4, 16)                                                                  \
+  X (4, 32)                                                                  \
+  X (8, 16)                                                                  \
+  X (8, 32)                                                                  \
+  X (8, 64)
+
+#endif
diff --git a/sysdeps/riscv/rvd/vecmath_config.h b/sysdeps/riscv/rvd/vecmath_config.h
new file mode 100644
index 0000000000..3a5af212e4
--- /dev/null
+++ b/sysdeps/riscv/rvd/vecmath_config.h
@@ -0,0 +1,110 @@
+/* Copyright (C) 2026 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _VECMATH_CONFIG_H
+#define _VECMATH_CONFIG_H
+
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+#define __VCFG_PASTE4_BASE(A, B, C, D) A##B##C##D
+#define __VCFG_PASTE4(A, B, C, D) __VCFG_PASTE4_BASE (A, B, C, D)
+#define __VCFG_PASTE5_BASE(A, B, C, D, E) A##B##C##D##E
+#define __VCFG_PASTE5(A, B, C, D, E) __VCFG_PASTE5_BASE (A, B, C, D, E)
+
+#define __MAKE_VMERGE_VVM(T) \
+  __VCFG_PASTE5 (__riscv_vmerge_vvm_, T, BIT_WIDTH, m, LMUL)
+#define __MAKE_VMERGE_VXM(T) \
+  __VCFG_PASTE5 (__riscv_vmerge_vxm_, T, BIT_WIDTH, m, LMUL)
+#define __MAKE_VFMERGE_VFM \
+  __VCFG_PASTE4 (__riscv_vfmerge_vfm_f, BIT_WIDTH, m, LMUL)
+#define __MAKE_VFMUL_VF_M \
+  __VCFG_PASTE5 (__riscv_vfmul_vf_f, BIT_WIDTH, m, LMUL, _m)
+#define __MAKE_VFREC7_M \
+  __VCFG_PASTE5 (__riscv_vfrec7_v_f, BIT_WIDTH, m, LMUL, _m)
+#define __MAKE_VFADD_VV_M \
+  __VCFG_PASTE5 (__riscv_vfadd_vv_f, BIT_WIDTH, m, LMUL, _m)
+
+#define VMERGE_VVM_F(op1, op2, mask, vlen) \
+  __MAKE_VMERGE_VVM (f) ((op1), (op2), (mask), (vlen))
+#define VMERGE_VXM_I(op1, scalar, mask, vlen) \
+  __MAKE_VMERGE_VXM (i) ((op1), (scalar), (mask), (vlen))
+#define VFMERGE_VFM(op1, scalar, mask, vlen) \
+  __MAKE_VFMERGE_VFM ((op1), (scalar), (mask), (vlen))
+#define VFMUL_VF_M(mask, op1, scalar, vlen) \
+  __MAKE_VFMUL_VF_M ((mask), (op1), (scalar), (vlen))
+#define VFREC7_M(mask, op1, vlen) \
+  __MAKE_VFREC7_M ((mask), (op1), (vlen))
+#define VFADD_VV_M(mask, op1, op2, vlen) \
+  __MAKE_VFADD_VV_M ((mask), (op1), (op2), (vlen))
+
+#ifndef FE_TONEAREST
+#define FE_TONEAREST 0x000
+#endif
+
+#define read_frm()                                                            \
+  ({                                                                          \
+    unsigned long __value;                                                    \
+    __asm__ __volatile__ ("frrm %0" : "=r"(__value)::"memory");               \
+    __value;                                                                  \
+  })
+
+#define write_frm(value)                                                      \
+  ({                                                                          \
+    unsigned long __value;                                                    \
+    __asm__ __volatile__ ("fsrm %0, %1"                                       \
+                          : "=r"(__value)                                     \
+                          : "r"(value)                                        \
+                          : "memory");                                        \
+    __value;                                                                  \
+  })
+
+#define SET_ROUNDTONEAREST                                                    \
+  int __original_frm = read_frm ();                                           \
+  if (__original_frm != FE_TONEAREST)                                         \
+  {                                                                           \
+    write_frm (FE_TONEAREST);                                                 \
+  }
+
+#define RESTORE_FRM                                                           \
+  do                                                                          \
+  {                                                                           \
+    if (__original_frm != FE_TONEAREST)                                       \
+    {                                                                         \
+      write_frm (__original_frm);                                             \
+    }                                                                         \
+  }                                                                           \
+  while (0)
+
+#define PSTEP(coeff_j, x, poly, vlen)                                         \
+  __riscv_vfmadd ((poly), (x), VFMV_VF ((coeff_j), (vlen)), (vlen))
+
+#define IDENTIFY(vclass, stencil, identity_mask, vlen)                        \
+  identity_mask = __riscv_vmsgtu (__riscv_vand ((vclass), (stencil), (vlen)), \
+                                  0, (vlen))
+
+/* Define the table for table-driven implementations. */
+#define V_LOG_TABLE_BITS 7
+extern const struct v_log_data
+{
+  const int64_t table[1 << V_LOG_TABLE_BITS];
+} __v_log_data attribute_hidden;
+
+__END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/riscv/libmvec.abilist b/sysdeps/unix/sysv/linux/riscv/libmvec.abilist
new file mode 100644
index 0000000000..2592c2dc6f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/libmvec.abilist
@@ -0,0 +1,11 @@
+GLIBC_2.43 _ZGVr1N2v_log F
+GLIBC_2.43 _ZGVr1N4v_log F
+GLIBC_2.43 _ZGVr2N2v_log F
+GLIBC_2.43 _ZGVr2N4v_log F
+GLIBC_2.43 _ZGVr2N8v_log F
+GLIBC_2.43 _ZGVr4N4v_log F
+GLIBC_2.43 _ZGVr4N8v_log F
+GLIBC_2.43 _ZGVr4N16v_log F
+GLIBC_2.43 _ZGVr8N8v_log F
+GLIBC_2.43 _ZGVr8N16v_log F
+GLIBC_2.43 _ZGVr8N32v_log F
-- 
2.47.3



More information about the Libc-alpha mailing list