softfloat: Add new flag for when denormal result is flushed to zero
Add a new float_flag_output_denormal which is set when the resultof a floating point operation would be denormal but is flushed tozero because we are in flush_to_zero mode. This is necessary because...
softfloat: fix float*_scalnb() corner cases
float*_scalnb() were not taking into account all cases. This patch fixessome corner cases:- NaN values in input were not properly propagated and the invalid flag not correctly raised. Use propagateFloat*NaN() for that....
softfloat-native: fix float*_scalbn() functions
float*_scalbn() should be able to take a status parameter. Fix that.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
softfloat-native: add float*_is_any_nan() functions
Add float*_is_any_nan() functions to match the softfloat API.
softfloat: fix floatx80 handling of NaN
The floatx80 format uses an explicit bit that should be taken into accountwhen converting to and from commonNaN format.
When converting to commonNaN, the explicit bit should be removed if it isa 1, and a default NaN should be used if it is 0....
softfloat: fix floatx80_is_infinity()
With floatx80, the explicit bit is set for infinity.
softfloat: add floatx80 constants
Add floatx80 constants similarly to float32 or float64.
softfloat: add pi constants
Add a pi constant for float32, float64, floatx80. It will be used bytarget-i386 and later by the trigonometric functions.
softfloat-native: add a few constant values
softfloat: add floatx80_compare*() functions
Add floatx80_compare() and floatx80_compare_quiet() functions to matchthe softfloat-native ones.
softfloat: move float*_eq and float*_eq_quiet
I am not a big fan of code moving, but having the signaling version inthe middle of quiet versions and vice versa doesn't make the code easyto read.
This patch is a simple code move, basically swapping locations of...
softfloat: improve description of comparison functions
Make clear for all comparison functions which ones trigger an exceptionfor all NaNs, and which one only for sNaNs.
softfloat: use GCC builtins to count the leading zeros
Softfloat has its own implementation to count the leading zeros. Howevera lot of architectures have either a dedicated instruction or anoptimized to do that. When using GCC >= 3.4, this patch uses GCC builtins...
softfloat: add float*_unordered_{,quiet}() functions
Add float*_unordered() functions to softfloat, matching the softfloat-nativeones. Also add float*_unordered_quiet() functions to match the otherscomparison functions.
This allow target-i386/ops_sse.h to be compiled with softfloat....
softfloat-native: add float*_unordered_quiet() functions
Add float*_unordered_quiet() functions to march the softfloat versions.As FPU status is not tracked with softfloat-native, they don't differfrom the signaling version.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
softfloat: rename float*_eq() into float*_eq_quiet()
float*_eq functions have a different semantics than other comparisonfunctions. Fix that by first renaming float*_quiet() into float*_eq_quiet().
Note that it is purely mechanical, and the behaviour should be unchanged....
softfloat: rename float*_eq_signaling() into float*_eq()
float*_eq_signaling functions have a different semantics than othercomparison functions. Fix that by renaming float*_quiet_signaling() intofloat*_eq().
softfloat: Add setter function for tininess detection mode
Add a setter function for the underflow tininess detection mode,in line with the similar functions for other parts of the float statusstructure.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
unicore32: necessary modifications for other files to support unicore32
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
softfloat: Add float*_min() and float*_max() functions
Add min and max operations to softfloat. This allows us to implementpropagation of NaNs and handling of negative zero correctly (unlikethe approach of having target helper routines return one of the operands...
softfloat: Drop [s]bits{8, 16, 32, 64} types in favor of [u]int{8, 16, 32, 64}_t
They are defined with the same semantics as the POSIX types,so prefer those for consistency. Suggested by Peter Maydell.
Cc: Peter Maydell <peter.maydell@linaro.org>Cc: Aurelien Jarno <aurelien@aurel32.net>...
softfloat: Resolve type mismatches between declaration and implementation
The original SoftFloat 2.0b library avoided the use of custom integer typesin its public headers. This requires the definitions of int{8,16,32,64} tomatch the assumptions in the declarations. This breaks on BeOS R5 and Haiku/x86,...
softfloat: Prepend QEMU-style header with derivation notice
The SoftFloat license requires "prominent notice that the workis derivative". Having added features like improved 16-bit supportfor arm already, add such a notice to the sources.
softfloat-native.[ch] are not under the SoftFloat license...
softfloat: move all default NaN definitions to softfloat.h.
These special values are needed to implement some helper functions,which return/use these values in some cases.
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
softfloat: add _set_sign(), _infinity and _half for 32 and 64 bits floats.
These constants and utility function are needed to implement somehelpers. Defining constants avoids the need to re-compute them atruntime.
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>...
softfloat: Fix compilation failures with USE_SOFTFLOAT_STRUCT_TYPES
Make softfloat compile with USE_SOFTFLOAT_STRUCT_TYPES defined, byadding and using new macros const_float16(), const_float32() andconst_float64() so you can use array initializers in an array of...
softfloat: Correctly handle NaNs in float16_to_float32()
Correctly handle NaNs in float16_to_float32(), by defining andusing a float16ToCommonNaN() function, as we do with the other formats.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
softfloat: Fix single-to-half precision float conversions
Fix various bugs in the single-to-half-precision conversion code: * input NaNs not correctly converted in IEEE mode (fixed by defining and using a commonNaNToFloat16()) * wrong values returned when converting NaN/Inf into non-IEEE...
softfloat: Honour default_nan_mode for float-to-float conversions
Honour the default_nan_mode flag when doing conversions betweendifferent floating point formats, as well as when returning a NaN froma two-operand floating point function. This corrects the behaviour...
softfloat: Add float16 type and float16 NaN handling functions
Add a float16 type to softfloat, rather than using bits16 directly.Also add the missing functions float16_is_quiet_nan(),float16_is_signaling_nan() and float16_maybe_silence_nan(),which are needed for the float16 conversion routines....
softfloat: fix floatx80_is_{quiet,signaling}_nan()
floatx80_is_{quiet,signaling}_nan() functions are incorrectly detectingthe type of NaN, depending on SNAN_BIT_IS_ONE, one of the two isreturning the correct value, and the other true for any kind of NaN....
softfloat: Add float32_is_zero_or_denormal() function
Add a utility function to softfloat to test whether a float32is zero or denormal.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
softfloat: SH4 has the sNaN bit set
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
softfloat: fix default-NaN mode
When the default-NaN mode is enabled, it should return the default NaNvalue, but it should anyway raise the invalid operation flag if one ofthe operand is an sNaN.
I have checked that this behavior matches the ARM and SH4 manuals, as...
softfloat: Implement floatx80_is_any_nan() and float128_is_any_nan()
Implement versions of float*_is_any_nan() for the floatx80 andfloat128 types.
Acked-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
softfloat: Implement flushing input denormals to zero
Add support to softfloat for flushing input denormal float32 and float64to zero. softfloat's existing 'flush_to_zero' flag only flushes denormalsto zero on output. Some CPUs need input denormals to be flushed before...
target-ppc: Implement correct NaN propagation rules
Implement the correct NaN propagation rules for PowerPC targets byproviding an appropriate pickNaN function.
Also fix the #ifdef tests for default NaN definition, the correct nameis TARGET_PPC instead of TARGET_POWERPC....
target-mips: Implement correct NaN propagation rules
Implement the correct NaN propagation rules for MIPS targets byproviding an appropriate pickNaN function.
softfloat: use float{32,64,x80,128}_maybe_silence_nan()
Use float{32,64,x80,128}_maybe_silence_nan() instead of toggling thesNaN bit manually. This allow per target implementation of sNaN to qNaNconversion.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
softfloat: add float{x80,128}_maybe_silence_nan()
Add float{x80,128}_maybe_silence_nan() functions, they will be need bypropagateFloat{x80,128}NaN().
softfloat: fix float{32,64}_maybe_silence_nan() for MIPS
On targets that define sNaN with the sNaN bit as one, simply clearingthis bit may correspond to an infinite value.
Convert it to a default NaN if SNAN_BIT_IS_ONE, as it corresponds tothe MIPS implementation, the only emulated CPU with SNAN_BIT_IS_ONE....
softfloat: rename *IsNaN variables to *IsQuietNaN
Similarly to what has been done in commit185698715dfb18c82ad2a5dbc169908602d43e81 rename the misnamed *IsNaNvariables into *IsQuietNaN.
softfloat: remove HPPA specific code
We don't have any HPPA target, so let's remove HPPA specific code. Itcan be re-added when someone adds an HPPA target.
This has been blessed by Stuart Brady <sdb@zubnet.me.uk>, author of thetarget-hppa fork.
target-arm: Implement correct NaN propagation rules
Implement the correct NaN propagation rules for ARM targets byproviding an appropriate pickNaN function.
softfloat: abstract out target-specific NaN propagation rules
IEEE754 doesn't specify precisely what NaN should be returned asthe result of an operation on two input NaNs. This is thereforetarget-specific. Abstract out the code in propagateFloat*NaN()which was implementing the x87 propagation rules, so that it...
softfloat: Rename float*_is_nan() functions to float*_is_quiet_nan()
The softfloat functions float*_is_nan() were badly misnamed,because they return true only for quiet NaNs, not for all NaNs.Rename them to float*_is_quiet_nan() to more accurately reflect...
softfloat: Add float*_is_any_nan() functions
Add float*_is_any_nan() functions which return true if the argumentis a NaN of any kind (quiet or signalling).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
softfloat: Add float*_maybe_silence_nan() functions
Add functions float*_maybe_silence_nan() which ensure that avalue is not a signaling NaN by turning it into a quiet NaN.
softfloat: Add float/double to 16 bit integer conversion functions
The ARM architecture needs float/double to 16 bit integer conversions.(The 32 bit versions aren't sufficient because of the requirementto saturate at 16 bit MAXINT/MININT and to get the exception bits right.)...
softfloat: add float32_exp2()
softfloat: remove dead assignments, spotted by clang
Value stored to 'bSign' is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-alpha: Split up FPCR value into separate fields.
The fpcr_exc_status, fpcr_exc_mask, and fpcr_dyn_round fieldsare stored in <softfloat.h> format for convenience duringregular execution.
Revert the addition of float_exception_mask to float_status,...
arm host: fix compiler warning
Compilation for arm (native or cross) results in thiswarning:
fpu/softfloat-native.c: In function ‘float64_round_to_int’:fpu/softfloat-native.c:387: error: control reaches end of non-void function
float64_round_to_int uses special assembler code for arm...
target-alpha: Enable softfloat.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-alpha: Fixes for alpha-linux syscalls.
1. Add correct definitions of error numbers.2. Implement SYS_osf_sigprocmask3. Implement SYS_osf_get/setsysinfo for IEEE_FP_CONTROL.
This last requires exposing the FPCR value to do_syscall.Since this value is actually split up into the float_status,...
Silence softfloat warnings on OpenSolaris
Don't define C99 math functions on OpenSolaris (Solaris 11),which still ships GCC 3.4.3. This fixes redefinition warnings.
Spotted by Palle Lyckegaard.
Signed-off-by: Andreas Färber <afaerber@opensolaris.org>Cc: Palle Lyckegaard <palle@lyckegaard.dk>...
Add support for GNU/kFreeBSD
ARM FP16 support
Implement the ARM VFP half precision floating point extensions.
Signed-off-by: Paul Brook <paul@codesourcery.com>
rename NEEDS_LIBSUNMATH to CONFIG_NEEDS_LIBSUNMATH
Once there fix a place where it was misspelled
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN
rename HOST_BSD to CONFIG_BSD
change HOST_SOLARIS to CONFIG_SOLARIS{_VERSION}
Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
Fix OpenSolaris softfloat warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7102 c046a42c-6fe2-441c-8c8c-71466251a162
Rename one more _BSD to HOST_BSD (spotted by Hasso Tepper)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6782 c046a42c-6fe2-441c-8c8c-71466251a162
Rename _BSD to HOST_BSD so that it's more obvious that it's defined by configure
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6775 c046a42c-6fe2-441c-8c8c-71466251a162
Sparse fixes: dubious mixing of bitwise and logical operations
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6741 c046a42c-6fe2-441c-8c8c-71466251a162
soft-float: add float32_log2() and float64_log2()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6518 c046a42c-6fe2-441c-8c8c-71466251a162
softfloat: add a 1.0 constant for float32 and float64
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6514 c046a42c-6fe2-441c-8c8c-71466251a162
Add static qualifier to local functions
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6436 c046a42c-6fe2-441c-8c8c-71466251a162
Remove all traces of powerpc
According to $GCC/gcc/config/rs6000/rs6000-c.c _ARCH_PPC is theubiquitous define which should be used to test whether gcc targetsPowerPC, on 64bit platforms _ARCH_PPC64 will be also defined.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6301 c046a42c-6fe2-441c-8c8c-71466251a162
softfloat-native: fix type of float_rounding_mode
fegetround() and fesetround() are using an int type. Change the type offloat_rounding_mode and floatx80_rounding_precision in the float_statusstructure for consistency.
Implement flush-to-zero mode (denormal results are replaced with zero).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6107 c046a42c-6fe2-441c-8c8c-71466251a162
Implement default-NaN mode.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6106 c046a42c-6fe2-441c-8c8c-71466251a162
Correctly normalize values and handle zero inputs to scalbn functions.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6102 c046a42c-6fe2-441c-8c8c-71466251a162
fp: fix float32_is_infinity()
Thanks to Laurent Desnogues for the hint.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6089 c046a42c-6fe2-441c-8c8c-71466251a162
softfloat-native: improve correctness of floatXX_is_neg()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6059 c046a42c-6fe2-441c-8c8c-71466251a162
fp: add floatXX_is_infinity(), floatXX_is_neg(), floatXX_is_zero()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6050 c046a42c-6fe2-441c-8c8c-71466251a162
softfloat-native: fix *nan()
Fix float64_is_nan()Fix floatx80_is_signaling_nan()Add floatx80_is_nan()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6049 c046a42c-6fe2-441c-8c8c-71466251a162
Use float_relation_* constants
Use float_relation_* constants rather than magic numbers insoftfloat-native comparison routines.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6025 c046a42c-6fe2-441c-8c8c-71466251a162
softfloat-native: add float32_is_nan()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6002 c046a42c-6fe2-441c-8c8c-71466251a162
Remove unnecessary trailing newlines
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
Add native softfloat fpu functions (Christoph Egger)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5775 c046a42c-6fe2-441c-8c8c-71466251a162
Preliminary AIX support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5732 c046a42c-6fe2-441c-8c8c-71466251a162
Fix ARM default NaN.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5618 c046a42c-6fe2-441c-8c8c-71466251a162
Fix undeclared symbol warnings from sparse
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5539 c046a42c-6fe2-441c-8c8c-71466251a162
Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5275 c046a42c-6fe2-441c-8c8c-71466251a162
Fix math warnings on OpenBSD -current
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5077 c046a42c-6fe2-441c-8c8c-71466251a162
Preliminary OpenBSD host support (based on OpenBSD patches by Todd T. Fries)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5012 c046a42c-6fe2-441c-8c8c-71466251a162
Assortment of soft-float fixes, by Aurelien Jarno.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3860 c046a42c-6fe2-441c-8c8c-71466251a162
128-bit float support for user mode
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3740 c046a42c-6fe2-441c-8c8c-71466251a162
Fix more typos in softloat code (Eduardo Felipe)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3716 c046a42c-6fe2-441c-8c8c-71466251a162
Fix typo in softfloat code.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3714 c046a42c-6fe2-441c-8c8c-71466251a162
Add strict checking mode for softfp code.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3688 c046a42c-6fe2-441c-8c8c-71466251a162
Fix NaN handling for MIPS and HPPA.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3655 c046a42c-6fe2-441c-8c8c-71466251a162
ARMv7 support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3572 c046a42c-6fe2-441c-8c8c-71466251a162
find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
Add proper float*_is_nan prototypes.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2902 c046a42c-6fe2-441c-8c8c-71466251a162
Fix softfloat NaN handling.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2805 c046a42c-6fe2-441c-8c8c-71466251a162
Check that HOST_SOLARIS is defined before relying on its value.Spotted by Joachim Henke.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2712 c046a42c-6fe2-441c-8c8c-71466251a162