--- /dev/null
+#ifdef __SSE4_1__
+# define USE_TRUNC_BUILTIN 1
+# define USE_TRUNCF_BUILTIN 1
+#else
+# define USE_TRUNC_BUILTIN 0
+# define USE_TRUNCF_BUILTIN 0
+#endif
+#define USE_TRUNCL_BUILTIN 0
+#define USE_TRUNCF128_BUILTIN 0
# Check if ISA level is 3 or above.
ifneq (,$(filter $(have-x86-isa-level),$(x86-isa-level-3-or-above)))
+sysdep_routines += \
+ s_modf-avx \
+ s_modff-avx \
+# sysdep_routines
libm-sysdep_routines += \
s_ceil-avx \
s_ceilf-avx \
s_floor-avx \
s_floorf-avx \
+ s_modf-avx \
+ s_modff-avx \
s_nearbyint-avx \
s_nearbyintf-avx \
s_rint-avx \
s_tan-fma4 \
# libm-sysdep_routines
endif
+sysdep_routines += \
+ s_modf-sse4_1 \
+ s_modff-sse4_1 \
+# sysdep_routines
libm-sysdep_routines += \
e_asin-fma \
e_atan2-avx \
s_floor-sse4_1 \
s_floorf-sse4_1 \
s_log1p-fma \
+ s_modf-sse4_1 \
+ s_modff-sse4_1 \
s_nearbyint-sse4_1 \
s_nearbyintf-sse4_1 \
s_rint-sse4_1 \
s_truncf-sse4_1 \
# libm-sysdep_routines
ifeq ($(have-x86-isa-level),baseline)
+sysdep_routines += \
+ s_modf-c \
+ s_modff-c \
+# sysdep-routines
libm-sysdep_routines += \
s_ceil-c \
s_ceilf-c \
s_floor-c \
s_floorf-c \
+ s_modf-c \
+ s_modff-c \
s_nearbyint-c \
s_nearbyintf-c \
s_rint-c \
CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX
CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
CFLAGS-s_sincos-avx.c = -msse2avx -DSSE2AVX
+
+CFLAGS-s_modf-sse4_1.c = -msse4.1 -fno-builtin-modff32x -fno-builtin-modff64
+CFLAGS-s_modff-sse4_1.c = -msse4.1 -fno-builtin-modff32
+
+CFLAGS-s_modf-avx.c = -msse2avx -DSSE2AVX -fno-builtin-modff32x -fno-builtin-modff64
+CFLAGS-s_modff-avx.c = -msse2avx -DSSE2AVX -fno-builtin-modff32
endif
ifeq ($(subdir),mathvec)
--- /dev/null
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
--- /dev/null
+#define __modf __modf_c
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
--- /dev/null
+#include <sysdeps/x86/isa-level.h>
+
+#if MINIMUM_X86_ISA_LEVEL != SSE4_1_X86_ISA_LEVEL
+# define __modf __modf_sse41
+#endif
+
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
--- /dev/null
+/* Multiple versions of modf
+ Copyright (C) 2025 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 <sysdeps/x86/isa-level.h>
+#if MINIMUM_X86_ISA_LEVEL < SSE4_1_X86_ISA_LEVEL
+# define NO_MATH_REDIRECT
+# include <libm-alias-double.h>
+
+# define modf __redirect_modf
+# define __modf __redirect___modf
+# include <math.h>
+# undef modf
+# undef __modf
+
+# define SYMBOL_NAME modf
+# include "ifunc-sse4_1.h"
+
+libc_ifunc_redirected (__redirect_modf, __modf, IFUNC_SELECTOR ());
+libm_alias_double (__modf, modf)
+#endif
--- /dev/null
+#include <sysdeps/ieee754/flt-32/s_modff.c>
--- /dev/null
+#define __modff __modff_c
+#include <sysdeps/ieee754/flt-32/s_modff.c>
--- /dev/null
+#include <sysdeps/x86/isa-level.h>
+
+#if MINIMUM_X86_ISA_LEVEL != SSE4_1_X86_ISA_LEVEL
+# define __modff __modff_sse41
+#endif
+
+#include <sysdeps/ieee754/flt-32/s_modff.c>
--- /dev/null
+/* Multiple versions of modff
+ Copyright (C) 2025 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 <sysdeps/x86/isa-level.h>
+#if MINIMUM_X86_ISA_LEVEL < SSE4_1_X86_ISA_LEVEL
+# define NO_MATH_REDIRECT
+# include <libm-alias-float.h>
+
+# define modff __redirect_modff
+# define __modff __redirect___modff
+# include <math.h>
+# undef modff
+# undef __modff
+
+# define SYMBOL_NAME modff
+# include "ifunc-sse4_1.h"
+
+libc_ifunc_redirected (__redirect_modff, __modff, IFUNC_SELECTOR ());
+libm_alias_float (__modf, modf)
+#endif