iotests.py: Add (verify|has)_working_luks()
[qemu.git] / include / fpu / softfloat-helpers.h
blob735ed6b653ee45d2f05da42b730aebce56550e65
1 /*
2 * QEMU float support - standalone helpers
4 * This is provided for files that don't need the access to the full
5 * set of softfloat functions. Typically this is cpu initialisation
6 * code which wants to set default rounding and exceptions modes.
8 * The code in this source file is derived from release 2a of the SoftFloat
9 * IEC/IEEE Floating-point Arithmetic Package. Those parts of the code (and
10 * some later contributions) are provided under that license, as detailed below.
11 * It has subsequently been modified by contributors to the QEMU Project,
12 * so some portions are provided under:
13 * the SoftFloat-2a license
14 * the BSD license
15 * GPL-v2-or-later
17 * Any future contributions to this file after December 1st 2014 will be
18 * taken to be licensed under the Softfloat-2a license unless specifically
19 * indicated otherwise.
23 ===============================================================================
24 This C header file is part of the SoftFloat IEC/IEEE Floating-point
25 Arithmetic Package, Release 2a.
27 Written by John R. Hauser. This work was made possible in part by the
28 International Computer Science Institute, located at Suite 600, 1947 Center
29 Street, Berkeley, California 94704. Funding was partially provided by the
30 National Science Foundation under grant MIP-9311980. The original version
31 of this code was written as part of a project to build a fixed-point vector
32 processor in collaboration with the University of California at Berkeley,
33 overseen by Profs. Nelson Morgan and John Wawrzynek. More information
34 is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
35 arithmetic/SoftFloat.html'.
37 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
38 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
39 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
40 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
41 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
43 Derivative works are acceptable, even for commercial purposes, so long as
44 (1) they include prominent notice that the work is derivative, and (2) they
45 include prominent notice akin to these four paragraphs for those parts of
46 this code that are retained.
48 ===============================================================================
51 #ifndef _SOFTFLOAT_HELPERS_H_
52 #define _SOFTFLOAT_HELPERS_H_
54 #include "fpu/softfloat-types.h"
56 static inline void set_float_detect_tininess(bool val, float_status *status)
58 status->tininess_before_rounding = val;
61 static inline void set_float_rounding_mode(FloatRoundMode val,
62 float_status *status)
64 status->float_rounding_mode = val;
67 static inline void set_float_exception_flags(int val, float_status *status)
69 status->float_exception_flags = val;
72 static inline void set_floatx80_rounding_precision(int val,
73 float_status *status)
75 status->floatx80_rounding_precision = val;
78 static inline void set_flush_to_zero(bool val, float_status *status)
80 status->flush_to_zero = val;
83 static inline void set_flush_inputs_to_zero(bool val, float_status *status)
85 status->flush_inputs_to_zero = val;
88 static inline void set_default_nan_mode(bool val, float_status *status)
90 status->default_nan_mode = val;
93 static inline void set_snan_bit_is_one(bool val, float_status *status)
95 status->snan_bit_is_one = val;
98 static inline bool get_float_detect_tininess(float_status *status)
100 return status->tininess_before_rounding;
103 static inline FloatRoundMode get_float_rounding_mode(float_status *status)
105 return status->float_rounding_mode;
108 static inline int get_float_exception_flags(float_status *status)
110 return status->float_exception_flags;
113 static inline int get_floatx80_rounding_precision(float_status *status)
115 return status->floatx80_rounding_precision;
118 static inline bool get_flush_to_zero(float_status *status)
120 return status->flush_to_zero;
123 static inline bool get_flush_inputs_to_zero(float_status *status)
125 return status->flush_inputs_to_zero;
128 static inline bool get_default_nan_mode(float_status *status)
130 return status->default_nan_mode;
133 #endif /* _SOFTFLOAT_HELPERS_H_ */