about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2010-10-19 12:47:13 -0400
committerUlrich Drepper <drepper@gmail.com>2010-10-19 12:47:13 -0400
commit6ce0bb748d7de856cb2076b41625fe7cedac5e16 (patch)
treef55b2908bb8b2f28cc80e6753d47161b46aa58c7
parent475facd1f553ad6d45de1137bd2a22e70307c7bf (diff)
parent7c08a05c5f4f86f9e249c2554b1628da0f812364 (diff)
downloadglibc-6ce0bb748d7de856cb2076b41625fe7cedac5e16.tar.gz
glibc-6ce0bb748d7de856cb2076b41625fe7cedac5e16.tar.xz
glibc-6ce0bb748d7de856cb2076b41625fe7cedac5e16.zip
Merge branch 'master' of ssh://sourceware.org/git/glibc
Conflicts:
	ChangeLog
-rw-r--r--ChangeLog8
-rw-r--r--math/libm-test.inc15
-rw-r--r--sysdeps/ieee754/ldbl-128/s_fmal.c6
3 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 935e84f72c..613f8dfb3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,14 @@
 	* sysdeps/i386/fpu/s_fma.S: Removed.
 	* sysdeps/i386/fpu/s_fmal.S: Removed.
 
+2010-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #3268]
+	* math/libm-test.inc (fma_test): Add IEEE quad long double fmal tests.
+	* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Ensure a1 + u.d
+	computation is not scheduled after fetestexcept.  Fix value
+	of minimum denormal long double.
+
 2010-10-14  Jakub Jelinek  <jakub@redhat.com>
 
 	[BZ #3268]
diff --git a/math/libm-test.inc b/math/libm-test.inc
index ceed18d7fd..c6ed7a39fe 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -2844,6 +2844,21 @@ fma_test (void)
   TEST_fff_f (fma, 0xc.0000000000007ffp+10130L, -0x8.000000000000001p+4430L, 0xc.07000000001ffffp+14513L, -0xb.fffffffffffd7e4p+14563L);
   TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L);
 #endif
+#if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 113
+  TEST_fff_f (fma, 0x1.bb2de33e02ccbbfa6e245a7c1f71p-2584L, -0x1.6b500daf0580d987f1bc0cadfcddp-13777L, 0x1.613cd91d9fed34b33820e5ab9d8dp-16378L, -0x1.3a79fb50eb9ce887cffa0f09bd9fp-16360L);
+  TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L);
+  TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L);
+  TEST_fff_f (fma, -0x1.ac79c9376ef447f3827c9e9de008p-2228L, -0x1.5ba830022b6139e21fbe7270cad8p-6314L, 0x1.e8282b6a26bb6a9daf5c8e73e9f9p-8616L, 0x1.22f14a0253878a730cd1aee373adp-8541L);
+  TEST_fff_f (fma, -0x1.c69749ec574caaa2ab8e97ddb9f3p+2652L, 0x1.f34235ff9d095449c29b4831b62dp+3311L, 0x1.fbe4302df23354dbd0c4d3cfe606p+5879L, -0x1.bb473bfdfb7a6e18886ce6e57eafp+5964L);
+  TEST_fff_f (fma, -0x1.ca8835fc6ecfb5398625fc891be5p-1686L, 0x1.621e1972bbe2180e5be9dd7d8df5p-7671L, -0x1.7d2d21b73b52cf20dec2a83902a4p-9395L, -0x1.3d2322191c9c88bc68a62ab8042cp-9356L);
+  TEST_fff_f (fma, -0x1.55cff679ec49c2541fab41fc843ep-11819L, 0x1.e60e9f464f9e8df0509647c7c971p+12325L, 0x1.eaa2a7649d765c2f564f7a5beca7p+454L, -0x1.447e29fa7e406a285f4e350fcf86p+507L);
+  TEST_fff_f (fma, 0x1.f0e7b1454908576f2537d863cf9bp+11432L, 0x1.cdce52f09d4ca76e68706f34b5d5p-1417L, -0x1.2e986187c70f146235ea2066e486p+9979L, 0x1.c030dad3cc5643f3dd0f5619f661p+10016L);
+  TEST_fff_f (fma, 0x1.f102f7da4a57a3a4aab620e29452p-3098L, -0x1.cc06a4ff40248f9e2dcc4b6afd84p-11727L, 0x1.d512a11126b5ac8ed8973b8580c8p-14849L, -0x1.be8f1cf737ab4d1c31c54f5ec23bp-14824L);
+  TEST_fff_f (fma, -0x1.fc47ac7434b993cd8dcb2b431f25p-3816L, 0x1.fbc9750da8468852d84558e1db6dp-5773L, -0x1.00a98abf783f75c40fe5b7a37d86p-9607L, -0x1.f81917b166f45e763cfcc057e2adp-9588L);
+  TEST_fff_f (fma, 0x1.00000000000007ffffffffffffffp-9045L, -0x1.ffffffffffff80000001ffffffffp+4773L, -0x1.f8p-4316L, -0x1.00000000000f88000000fffffdffp-4271L);
+  TEST_fff_f (fma, 0x1.4e922764c90701d4a2f21d01893dp-8683L, -0x1.955a12e2d7c9447c27fa022fc865p+212L, -0x1.e9634462eaef96528b90b6944578p-8521L, -0x1.08e1783184a371943d3598e10865p-8470L);
+  TEST_fff_f (fma, 0x1.801181509c03bdbef10d6165588cp-15131L, 0x1.ad86f8e57d3d40bfa8007780af63p-368L, -0x1.6e9df0dab1c9f1d7a6043c390741p-15507L, 0x1.417c9b2b15e2ad57dc9e0e920844p-15498L);
+#endif
 
   END (fma);
 }
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index 9ec5ba9ee9..b750538b8a 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -175,6 +175,8 @@ __fmal (long double x, long double y, long double z)
       if ((u.ieee.mantissa3 & 1) == 0)
 	u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
       v.d = a1 + u.d;
+      /* Ensure the addition is not scheduled after fetestexcept call.  */
+      asm volatile ("" : "m" (v));
       int j = fetestexcept (FE_INEXACT) != 0;
       feupdateenv (&env);
       /* Ensure the following computations are performed in default rounding
@@ -207,9 +209,9 @@ __fmal (long double x, long double y, long double z)
 	    {
 	      v.d *= 0x1p-226L;
 	      if (v.ieee.negative)
-		return v.d - 0x1p-16493L /* __LDBL_DENORM_MIN__ */;
+		return v.d - 0x1p-16494L /* __LDBL_DENORM_MIN__ */;
 	      else
-		return v.d + 0x1p-16493L /* __LDBL_DENORM_MIN__ */;
+		return v.d + 0x1p-16494L /* __LDBL_DENORM_MIN__ */;
 	    }
 	  else
 	    return v.d * 0x1p-226L;