glibc/sysdeps/unix/mips/sysdep.h

83 lines
2.1 KiB
C
Raw Normal View History

/* Copyright (C) 1992-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
1993-08-26 23:31:15 +00:00
The GNU C Library is free software; you can redistribute it and/or
2001-07-06 04:56:23 +00:00
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.
1993-08-26 23:31:15 +00:00
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
2001-07-06 04:56:23 +00:00
Lesser General Public License for more details.
1993-08-26 23:31:15 +00:00
2001-07-06 04:56:23 +00:00
You should have received a copy of the GNU Lesser General Public
2012-03-09 23:56:38 +00:00
License along with the GNU C Library. If not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
<https://www.gnu.org/licenses/>. */
1993-08-26 23:31:15 +00:00
math: Don't redirect inlined builtin math functions When we want to inline builtin math functions, like truncf, for extern float truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__)); extern float __truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__)); float (truncf) (float) asm ("__truncf"); compiler may redirect truncf calls to __truncf, instead of inlining it (for instance, clang). The USE_TRUNCF_BUILTIN is 1 to indicate that truncf should be inlined. In this case, we don't want the truncf redirection: 1. For each math function which may be inlined, we define #if USE_TRUNCF_BUILTIN # define NO_truncf_BUILTIN inline_truncf #else # define NO_truncf_BUILTIN truncf #endif in <math-use-builtins.h>. 2. Include <math-use-builtins.h> in include/math.h. 3. Change MATH_REDIRECT to #define MATH_REDIRECT(FUNC, PREFIX, ARGS) \ float (NO_ ## FUNC ## f ## _BUILTIN) (ARGS (float)) \ asm (PREFIX #FUNC "f"); With this change If USE_TRUNCF_BUILTIN is 0, we get float (truncf) (float) asm ("__truncf"); truncf will be redirected to __truncf. And for USE_TRUNCF_BUILTIN 1, we get: float (inline_truncf) (float) asm ("__truncf"); In both cases either truncf will be inlined or the internal alias (__truncf) will be called. It is not required for all math-use-builtin symbol, only the one defined in math.h. It also allows to remove all the math-use-builtin inclusion, since it is now implicitly included by math.h. For MIPS, some math-use-builtin headers include sysdep.h and this in turn includes a lot of extra headers that do not allow ldbl-128 code to override alias definition (math.h will include some stdlib.h definition). The math-use-builtin only requires the __mips_isa_rev, so move the defintion to sgidefs.h. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 13:28:56 +00:00
#include <isarev.h>
#include <sgidefs.h>
1993-08-26 23:31:15 +00:00
#include <sysdeps/unix/sysdep.h>
1995-01-27 20:48:38 +00:00
#ifdef __ASSEMBLER__
1995-01-27 20:48:38 +00:00
1993-08-26 23:31:15 +00:00
#include <regdef.h>
#define ENTRY(name) \
.globl name; \
.align 2; \
1995-02-05 22:59:48 +00:00
.ent name,0; \
name##: \
cfi_startproc;
1993-08-26 23:31:15 +00:00
1997-07-12 23:28:11 +00:00
#undef END
#define END(function) \
cfi_endproc; \
.end function; \
.size function,.-function
1997-07-12 23:28:11 +00:00
#define ret j ra ; nop
#undef PSEUDO_END
#define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
#define PSEUDO_NOERRNO(name, syscall_name, args) \
.align 2; \
ENTRY(name) \
.set nomips16; \
.set noreorder; \
li v0, SYS_ify(syscall_name); \
syscall
#undef PSEUDO_END_NOERRNO
#define PSEUDO_END_NOERRNO(sym) cfi_endproc; .end sym; .size sym,.-sym
#define ret_NOERRNO ret
#define PSEUDO_ERRVAL(name, syscall_name, args) \
.align 2; \
ENTRY(name) \
.set nomips16; \
.set noreorder; \
li v0, SYS_ify(syscall_name); \
syscall
#undef PSEUDO_END_ERRVAL
#define PSEUDO_END_ERRVAL(sym) cfi_endproc; .end sym; .size sym,.-sym
#define ret_ERRVAL ret
1993-08-26 23:31:15 +00:00
#define r0 v0
#define r1 v1
/* The mips move insn is d,s. */
#define MOVE(x,y) move y , x
1995-01-27 20:48:38 +00:00
#if _MIPS_SIM == _ABIO32
# define L(label) $L ## label
#else
# define L(label) .L ## label
#endif
1995-01-27 20:48:38 +00:00
#endif