diff options
author | das <das@FreeBSD.org> | 2008-07-31 19:57:50 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2008-07-31 19:57:50 +0000 |
commit | 9f333dcb2cca361c8dcfe7743d1061e62e59913a (patch) | |
tree | 1eeb1f3e2bd18382c5a4cd6b9eac79e12656a791 /lib/msun | |
parent | 99ec4c843d18fdc20a8ba8ec77c64558085c8794 (diff) | |
download | FreeBSD-src-9f333dcb2cca361c8dcfe7743d1061e62e59913a.zip FreeBSD-src-9f333dcb2cca361c8dcfe7743d1061e62e59913a.tar.gz |
As in other parts of libm, mark a few constants as volatile to prevent
spurious optimizations. gcc doesn't support FENV_ACCESS, so when it
folds constants, it assumes that the rounding mode is always the
default and floating point exceptions never matter.
Diffstat (limited to 'lib/msun')
-rw-r--r-- | lib/msun/src/e_acos.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_acosf.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_atan2.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_atan2f.c | 6 | ||||
-rw-r--r-- | lib/msun/src/s_atan.c | 4 | ||||
-rw-r--r-- | lib/msun/src/s_atanf.c | 4 |
6 files changed, 20 insertions, 12 deletions
diff --git a/lib/msun/src/e_acos.c b/lib/msun/src/e_acos.c index 78fd582..5b1b85a 100644 --- a/lib/msun/src/e_acos.c +++ b/lib/msun/src/e_acos.c @@ -44,8 +44,10 @@ __FBSDID("$FreeBSD$"); static const double one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ +pio2_hi = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */ +static volatile double +pio2_lo = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */ +static const double pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c index 7a9d0d5..7fbf3b2 100644 --- a/lib/msun/src/e_acosf.c +++ b/lib/msun/src/e_acosf.c @@ -22,8 +22,10 @@ __FBSDID("$FreeBSD$"); static const float one = 1.0000000000e+00, /* 0x3F800000 */ pi = 3.1415925026e+00, /* 0x40490fda */ -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ +pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */ +static volatile float +pio2_lo = 7.5497894159e-08; /* 0x33a22168 */ +static const float pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ pS1 = -3.2556581497e-01, /* 0xbea6b090 */ pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ diff --git a/lib/msun/src/e_atan2.c b/lib/msun/src/e_atan2.c index 37c62c1..ba0b618 100644 --- a/lib/msun/src/e_atan2.c +++ b/lib/msun/src/e_atan2.c @@ -45,12 +45,14 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" +static volatile double +tiny = 1.0e-300; static const double -tiny = 1.0e-300, zero = 0.0, pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ -pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ +pi = 3.1415926535897931160E+00; /* 0x400921FB, 0x54442D18 */ +static volatile double pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ double diff --git a/lib/msun/src/e_atan2f.c b/lib/msun/src/e_atan2f.c index b6d336d..55435b4 100644 --- a/lib/msun/src/e_atan2f.c +++ b/lib/msun/src/e_atan2f.c @@ -19,12 +19,14 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" +static volatile float +tiny = 1.0e-30; static const float -tiny = 1.0e-30, zero = 0.0, pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ -pi = 3.1415927410e+00, /* 0x40490fdb */ +pi = 3.1415927410e+00; /* 0x40490fdb */ +static volatile float pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ float diff --git a/lib/msun/src/s_atan.c b/lib/msun/src/s_atan.c index 4b0ab89..01e7bea 100644 --- a/lib/msun/src/s_atan.c +++ b/lib/msun/src/s_atan.c @@ -82,8 +82,8 @@ atan(double x) if(ix>0x7ff00000|| (ix==0x7ff00000&&(low!=0))) return x+x; /* NaN */ - if(hx>0) return atanhi[3]+atanlo[3]; - else return -atanhi[3]-atanlo[3]; + if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3]; + else return -atanhi[3]-*(volatile double *)&atanlo[3]; } if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ if (ix < 0x3e200000) { /* |x| < 2^-29 */ if(huge+x>one) return x; /* raise inexact */ diff --git a/lib/msun/src/s_atanf.c b/lib/msun/src/s_atanf.c index 7990c64..8221b42 100644 --- a/lib/msun/src/s_atanf.c +++ b/lib/msun/src/s_atanf.c @@ -62,8 +62,8 @@ atanf(float x) if(ix>=0x50800000) { /* if |x| >= 2^34 */ if(ix>0x7f800000) return x+x; /* NaN */ - if(hx>0) return atanhi[3]+atanlo[3]; - else return -atanhi[3]-atanlo[3]; + if(hx>0) return atanhi[3]+*(volatile float *)&atanlo[3]; + else return -atanhi[3]-*(volatile float *)&atanlo[3]; } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ if (ix < 0x31000000) { /* |x| < 2^-29 */ if(huge+x>one) return x; /* raise inexact */ |