VirtualBox

source: vbox/trunk/include/iprt/nocrt/arm64/fenv.h@ 107288

Last change on this file since 107288 was 106557, checked in by vboxsync, 5 months ago

iprt/nocrt: fenv.h for arm64 (untested). jiraref:VBP-1191

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/** @file
2 * IPRT / No-CRT - ARM64 fenv.h.
3 */
4
5/*
6 * Copyright (C) 2022-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_nocrt_arm64_fenv_h
37#define IPRT_INCLUDED_nocrt_arm64_fenv_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/types.h>
43
44typedef struct RTNOCRTFENV
45{
46 /** The FPU status register FPSR. */
47 uint64_t fFpSR;
48 /** FPCR - The FPU control register FPCR. */
49 uint64_t fFpCR;
50} RTNOCRTFENV;
51
52/** Exception flags/mask. */
53typedef uint16_t RTNOCRTFEXCEPT;
54
55#ifndef IPRT_NOCRT_WITHOUT_CONFLICTING_TYPES
56typedef RTNOCRTFENV fenv_t;
57typedef RTNOCRTFEXCEPT fexcept_t;
58#endif
59
60/** @name Exception flags (see ARMV8_FPSR_XXX)
61 * @note ARMV8_FPSR_QC is omitted for now.
62 * @{ */
63#define RT_NOCRT_FE_INVALID 0x0001
64#define RT_NOCRT_FE_DIVBYZERO 0x0002
65#define RT_NOCRT_FE_OVERFLOW 0x0004
66#define RT_NOCRT_FE_UNDERFLOW 0x0008
67#define RT_NOCRT_FE_INEXACT 0x0010
68#define RT_NOCRT_FE_DENORMAL 0x0080
69#define RT_NOCRT_FE_FLUSHTOZERO RT_NOCRT_FE_DENORMAL
70#define RT_NOCRT_FE_ALL_EXCEPT 0x009f
71#ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS
72# define FE_INVALID RT_NOCRT_FE_INVALID
73# define FE_DIVBYZERO RT_NOCRT_FE_DIVBYZERO
74# define FE_OVERFLOW RT_NOCRT_FE_OVERFLOW
75# define FE_UNDERFLOW RT_NOCRT_FE_UNDERFLOW
76# define FE_INEXACT RT_NOCRT_FE_INEXACT
77# define FE_DENORMAL RT_NOCRT_FE_DENORMAL
78# define FE_FLUSHTOZERO RT_NOCRT_FE_FLUSHTOZERO
79# define FE_ALL_EXCEPT RT_NOCRT_FE_ALL_EXCEPT
80#endif
81/** @} */
82
83/** @name Rounding Modes (see ARMV8_FPCR_RMODE_MASK)
84 * @{ */
85#define RT_NOCRT_FE_TONEAREST 0x0000000
86#define RT_NOCRT_FE_DOWNWARD 0x0800000
87#define RT_NOCRT_FE_UPWARD 0x0400000
88#define RT_NOCRT_FE_TOWARDZERO 0x0c00000
89#define RT_NOCRT_FE_ROUND_MASK 0x0c00000
90#ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS
91# define FE_TONEAREST RT_NOCRT_FE_TONEAREST
92# define FE_DOWNWARD RT_NOCRT_FE_DOWNWARD
93# define FE_UPWARD RT_NOCRT_FE_UPWARD
94# define FE_TOWARDZERO RT_NOCRT_FE_TOWARDZERO
95#endif
96/** @} */
97
98
99/** @name x87 Precision (same X86_FCW_PC_XXX)
100 * @{ */
101#define RT_NOCRT_PC_FLOAT 0x0000
102#define RT_NOCRT_PC_RSVD 0x0100
103#define RT_NOCRT_PC_DOUBLE 0x0200
104#define RT_NOCRT_PC_EXTENDED 0x0300
105#define RT_NOCRT_PC_MASK 0x0300
106/** @} */
107
108
109/** @name Special environment pointer values.
110 * @note Only valid with fesetenv and feupdateenv.
111 * @{ */
112/** The default FPU environment set, all exceptions disabled (masked). */
113#define RT_NOCRT_FE_DFL_ENV ((RTNOCRTFENV const *)(intptr_t)1)
114/** The default FPU environment set, all exceptions disabled (masked) and
115 * denormals being flushed to zero. */
116#define RT_NOCRT_FE_DFL_DISABLE_DENORMS_ENV ((RTNOCRTFENV const *)(intptr_t)2)
117#ifndef IPRT_NOCRT_WITHOUT_MATH_CONSTANTS
118# define FE_DFL_ENV RT_NOCRT_FE_DFL_ENV
119# define FE_DFL_DISABLE_DENORMS_ENV RT_NOCRT_FE_DFL_DISABLE_DENORMS_ENV
120#endif
121/** @} */
122
123RT_C_DECLS_BEGIN
124
125int RT_NOCRT(fegetenv)(RTNOCRTFENV *);
126int RT_NOCRT(fesetenv)(RTNOCRTFENV const *);
127int RT_NOCRT(feholdexcept)(RTNOCRTFENV *);
128int RT_NOCRT(feupdateenv)(RTNOCRTFENV const *);
129
130int RT_NOCRT(fegetround)(void);
131int RT_NOCRT(fesetround)(int);
132
133int RT_NOCRT(fegetexcept)(void);
134int RT_NOCRT(feenableexcept)(int);
135int RT_NOCRT(fedisableexcept)(int);
136
137int RT_NOCRT(feclearexcept)(int);
138int RT_NOCRT(fetestexcept)(int);
139int RT_NOCRT(fegetexceptflag)(RTNOCRTFEXCEPT *, int);
140int RT_NOCRT(fesetexceptflag)(RTNOCRTFEXCEPT const *, int);
141
142int RT_NOCRT(feraiseexcept)(int);
143
144/* Underscored variants: */
145int RT_NOCRT(_fegetenv)(RTNOCRTFENV *);
146int RT_NOCRT(_fesetenv)(RTNOCRTFENV const *);
147int RT_NOCRT(_feholdexcept)(RTNOCRTFENV *);
148int RT_NOCRT(_feupdateenv)(RTNOCRTFENV const *);
149
150int RT_NOCRT(_fegetround)(void);
151int RT_NOCRT(_fesetround)(int);
152
153int RT_NOCRT(_fegetexcept)(void);
154int RT_NOCRT(_feenableexcept)(int);
155int RT_NOCRT(_fedisableexcept)(int);
156
157int RT_NOCRT(_feclearexcept)(int);
158int RT_NOCRT(_fetestexcept)(int);
159int RT_NOCRT(_fegetexceptflag)(RTNOCRTFEXCEPT *, int);
160int RT_NOCRT(_fesetexceptflag)(RTNOCRTFEXCEPT const *, int);
161
162int RT_NOCRT(_feraiseexcept)(int);
163
164/* Aliases: */
165#if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
166# define fegetenv RT_NOCRT(fegetenv)
167# define fesetenv RT_NOCRT(fesetenv)
168# define feholdexcept RT_NOCRT(feholdexcept)
169# define feupdateenv RT_NOCRT(feupdateenv)
170# define fegetround RT_NOCRT(fegetround)
171# define fesetround RT_NOCRT(fesetround)
172# define fegetexcept RT_NOCRT(fegetexcept)
173# define feenableexcept RT_NOCRT(feenableexcept)
174# define fedisableexcept RT_NOCRT(fedisableexcept)
175# define feclearexcept RT_NOCRT(feclearexcept)
176# define fetestexcept RT_NOCRT(fetestexcept)
177# define fegetexceptflag RT_NOCRT(fegetexceptflag)
178# define fesetexceptflag RT_NOCRT(fesetexceptflag)
179# define feraiseexcept RT_NOCRT(feraiseexcept)
180
181/* Underscored variants: */
182# define _fegetenv RT_NOCRT(fegetenv)
183# define _fesetenv RT_NOCRT(fesetenv)
184# define _feholdexcept RT_NOCRT(feholdexcept)
185# define _feupdateenv RT_NOCRT(feupdateenv)
186# define _fegetround RT_NOCRT(fegetround)
187# define _fesetround RT_NOCRT(fesetround)
188# define _fegetexcept RT_NOCRT(fegetexcept)
189# define _feenableexcept RT_NOCRT(feenableexcept)
190# define _fedisableexcept RT_NOCRT(fedisableexcept)
191# define _feclearexcept RT_NOCRT(feclearexcept)
192# define _fetestexcept RT_NOCRT(fetestexcept)
193# define _fegetexceptflag RT_NOCRT(fegetexceptflag)
194# define _fesetexceptflag RT_NOCRT(fesetexceptflag)
195# define _feraiseexcept RT_NOCRT(feraiseexcept)
196#endif
197
198RT_C_DECLS_END
199
200#endif /* !IPRT_INCLUDED_nocrt_arm64_fenv_h */
201
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette