~ubuntu-branches/ubuntu/hardy/qemu/hardy

« back to all changes in this revision

Viewing changes to fpu/softfloat.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2007-05-02 11:55:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502115516-rf8z0ba1ojbncx10
Tags: 0.9.0-1ubuntu1
* merged from Debian/experimental
* Merge from debian unstable, remaining changes:
   - Remove 34_syscalls_types.patch from debian/patches/series: add an
     unnecessary kernel header breaking compilation of linux-user/syscall.c.
   - Move proll and openhackware from Depends to Recommends.
   - set Maintainer field to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
2023
2023
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2024
2024
*----------------------------------------------------------------------------*/
2025
2025
 
2026
 
flag float32_eq( float32 a, float32 b STATUS_PARAM )
 
2026
int float32_eq( float32 a, float32 b STATUS_PARAM )
2027
2027
{
2028
2028
 
2029
2029
    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
2045
2045
| Arithmetic.
2046
2046
*----------------------------------------------------------------------------*/
2047
2047
 
2048
 
flag float32_le( float32 a, float32 b STATUS_PARAM )
 
2048
int float32_le( float32 a, float32 b STATUS_PARAM )
2049
2049
{
2050
2050
    flag aSign, bSign;
2051
2051
 
2068
2068
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2069
2069
*----------------------------------------------------------------------------*/
2070
2070
 
2071
 
flag float32_lt( float32 a, float32 b STATUS_PARAM )
 
2071
int float32_lt( float32 a, float32 b STATUS_PARAM )
2072
2072
{
2073
2073
    flag aSign, bSign;
2074
2074
 
2092
2092
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2093
2093
*----------------------------------------------------------------------------*/
2094
2094
 
2095
 
flag float32_eq_signaling( float32 a, float32 b STATUS_PARAM )
 
2095
int float32_eq_signaling( float32 a, float32 b STATUS_PARAM )
2096
2096
{
2097
2097
 
2098
2098
    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
2112
2112
| IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2113
2113
*----------------------------------------------------------------------------*/
2114
2114
 
2115
 
flag float32_le_quiet( float32 a, float32 b STATUS_PARAM )
 
2115
int float32_le_quiet( float32 a, float32 b STATUS_PARAM )
2116
2116
{
2117
2117
    flag aSign, bSign;
2118
2118
 
2138
2138
| Standard for Binary Floating-Point Arithmetic.
2139
2139
*----------------------------------------------------------------------------*/
2140
2140
 
2141
 
flag float32_lt_quiet( float32 a, float32 b STATUS_PARAM )
 
2141
int float32_lt_quiet( float32 a, float32 b STATUS_PARAM )
2142
2142
{
2143
2143
    flag aSign, bSign;
2144
2144
 
2483
2483
 
2484
2484
}
2485
2485
 
 
2486
float64 float64_trunc_to_int( float64 a STATUS_PARAM)
 
2487
{
 
2488
    int oldmode;
 
2489
    float64 res;
 
2490
    oldmode = STATUS(float_rounding_mode);
 
2491
    STATUS(float_rounding_mode) = float_round_to_zero;
 
2492
    res = float64_round_to_int(a STATUS_VAR);
 
2493
    STATUS(float_rounding_mode) = oldmode;
 
2494
    return res;
 
2495
}
 
2496
 
2486
2497
/*----------------------------------------------------------------------------
2487
2498
| Returns the result of adding the absolute values of the double-precision
2488
2499
| floating-point values `a' and `b'.  If `zSign' is 1, the sum is negated
2941
2952
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2942
2953
*----------------------------------------------------------------------------*/
2943
2954
 
2944
 
flag float64_eq( float64 a, float64 b STATUS_PARAM )
 
2955
int float64_eq( float64 a, float64 b STATUS_PARAM )
2945
2956
{
2946
2957
 
2947
2958
    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2963
2974
| Arithmetic.
2964
2975
*----------------------------------------------------------------------------*/
2965
2976
 
2966
 
flag float64_le( float64 a, float64 b STATUS_PARAM )
 
2977
int float64_le( float64 a, float64 b STATUS_PARAM )
2967
2978
{
2968
2979
    flag aSign, bSign;
2969
2980
 
2986
2997
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
2987
2998
*----------------------------------------------------------------------------*/
2988
2999
 
2989
 
flag float64_lt( float64 a, float64 b STATUS_PARAM )
 
3000
int float64_lt( float64 a, float64 b STATUS_PARAM )
2990
3001
{
2991
3002
    flag aSign, bSign;
2992
3003
 
3010
3021
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
3011
3022
*----------------------------------------------------------------------------*/
3012
3023
 
3013
 
flag float64_eq_signaling( float64 a, float64 b STATUS_PARAM )
 
3024
int float64_eq_signaling( float64 a, float64 b STATUS_PARAM )
3014
3025
{
3015
3026
 
3016
3027
    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
3030
3041
| IEC/IEEE Standard for Binary Floating-Point Arithmetic.
3031
3042
*----------------------------------------------------------------------------*/
3032
3043
 
3033
 
flag float64_le_quiet( float64 a, float64 b STATUS_PARAM )
 
3044
int float64_le_quiet( float64 a, float64 b STATUS_PARAM )
3034
3045
{
3035
3046
    flag aSign, bSign;
3036
3047
 
3056
3067
| Standard for Binary Floating-Point Arithmetic.
3057
3068
*----------------------------------------------------------------------------*/
3058
3069
 
3059
 
flag float64_lt_quiet( float64 a, float64 b STATUS_PARAM )
 
3070
int float64_lt_quiet( float64 a, float64 b STATUS_PARAM )
3060
3071
{
3061
3072
    flag aSign, bSign;
3062
3073
 
3879
3890
| Arithmetic.
3880
3891
*----------------------------------------------------------------------------*/
3881
3892
 
3882
 
flag floatx80_eq( floatx80 a, floatx80 b STATUS_PARAM )
 
3893
int floatx80_eq( floatx80 a, floatx80 b STATUS_PARAM )
3883
3894
{
3884
3895
 
3885
3896
    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
3909
3920
| Floating-Point Arithmetic.
3910
3921
*----------------------------------------------------------------------------*/
3911
3922
 
3912
 
flag floatx80_le( floatx80 a, floatx80 b STATUS_PARAM )
 
3923
int floatx80_le( floatx80 a, floatx80 b STATUS_PARAM )
3913
3924
{
3914
3925
    flag aSign, bSign;
3915
3926
 
3942
3953
| Arithmetic.
3943
3954
*----------------------------------------------------------------------------*/
3944
3955
 
3945
 
flag floatx80_lt( floatx80 a, floatx80 b STATUS_PARAM )
 
3956
int floatx80_lt( floatx80 a, floatx80 b STATUS_PARAM )
3946
3957
{
3947
3958
    flag aSign, bSign;
3948
3959
 
3975
3986
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
3976
3987
*----------------------------------------------------------------------------*/
3977
3988
 
3978
 
flag floatx80_eq_signaling( floatx80 a, floatx80 b STATUS_PARAM )
 
3989
int floatx80_eq_signaling( floatx80 a, floatx80 b STATUS_PARAM )
3979
3990
{
3980
3991
 
3981
3992
    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
4002
4013
| to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
4003
4014
*----------------------------------------------------------------------------*/
4004
4015
 
4005
 
flag floatx80_le_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 
4016
int floatx80_le_quiet( floatx80 a, floatx80 b STATUS_PARAM )
4006
4017
{
4007
4018
    flag aSign, bSign;
4008
4019
 
4038
4049
| IEC/IEEE Standard for Binary Floating-Point Arithmetic.
4039
4050
*----------------------------------------------------------------------------*/
4040
4051
 
4041
 
flag floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 
4052
int floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM )
4042
4053
{
4043
4054
    flag aSign, bSign;
4044
4055
 
4999
5010
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
5000
5011
*----------------------------------------------------------------------------*/
5001
5012
 
5002
 
flag float128_eq( float128 a, float128 b STATUS_PARAM )
 
5013
int float128_eq( float128 a, float128 b STATUS_PARAM )
5003
5014
{
5004
5015
 
5005
5016
    if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
5029
5040
| Arithmetic.
5030
5041
*----------------------------------------------------------------------------*/
5031
5042
 
5032
 
flag float128_le( float128 a, float128 b STATUS_PARAM )
 
5043
int float128_le( float128 a, float128 b STATUS_PARAM )
5033
5044
{
5034
5045
    flag aSign, bSign;
5035
5046
 
5061
5072
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
5062
5073
*----------------------------------------------------------------------------*/
5063
5074
 
5064
 
flag float128_lt( float128 a, float128 b STATUS_PARAM )
 
5075
int float128_lt( float128 a, float128 b STATUS_PARAM )
5065
5076
{
5066
5077
    flag aSign, bSign;
5067
5078
 
5094
5105
| according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
5095
5106
*----------------------------------------------------------------------------*/
5096
5107
 
5097
 
flag float128_eq_signaling( float128 a, float128 b STATUS_PARAM )
 
5108
int float128_eq_signaling( float128 a, float128 b STATUS_PARAM )
5098
5109
{
5099
5110
 
5100
5111
    if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
5121
5132
| IEC/IEEE Standard for Binary Floating-Point Arithmetic.
5122
5133
*----------------------------------------------------------------------------*/
5123
5134
 
5124
 
flag float128_le_quiet( float128 a, float128 b STATUS_PARAM )
 
5135
int float128_le_quiet( float128 a, float128 b STATUS_PARAM )
5125
5136
{
5126
5137
    flag aSign, bSign;
5127
5138
 
5157
5168
| Standard for Binary Floating-Point Arithmetic.
5158
5169
*----------------------------------------------------------------------------*/
5159
5170
 
5160
 
flag float128_lt_quiet( float128 a, float128 b STATUS_PARAM )
 
5171
int float128_lt_quiet( float128 a, float128 b STATUS_PARAM )
5161
5172
{
5162
5173
    flag aSign, bSign;
5163
5174
 
5272
5283
}
5273
5284
 
5274
5285
#define COMPARE(s, nan_exp)                                                  \
5275
 
INLINE char float ## s ## _compare_internal( float ## s a, float ## s b,     \
 
5286
INLINE int float ## s ## _compare_internal( float ## s a, float ## s b,      \
5276
5287
                                      int is_quiet STATUS_PARAM )            \
5277
5288
{                                                                            \
5278
5289
    flag aSign, bSign;                                                       \
5306
5317
    }                                                                        \
5307
5318
}                                                                            \
5308
5319
                                                                             \
5309
 
char float ## s ## _compare( float ## s a, float ## s b STATUS_PARAM )       \
 
5320
int float ## s ## _compare( float ## s a, float ## s b STATUS_PARAM )        \
5310
5321
{                                                                            \
5311
5322
    return float ## s ## _compare_internal(a, b, 0 STATUS_VAR);              \
5312
5323
}                                                                            \
5313
5324
                                                                             \
5314
 
char float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM ) \
 
5325
int float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM )  \
5315
5326
{                                                                            \
5316
5327
    return float ## s ## _compare_internal(a, b, 1 STATUS_VAR);              \
5317
5328
}