libgcc/ChangeLog:
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Dec 2013 18:57:37 +0000 (18:57 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Dec 2013 18:57:37 +0000 (18:57 +0000)
2013-12-03  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

* config/rs6000/ibm-ldouble.c (__gcc_qadd): Fix add
of normal number and qNaN to not raise an inexact exception.

gcc/testsuite/ChangeLog:

2013-12-03  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

* gcc.target/powerpc/pr57363.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205645 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr57363.c [new file with mode: 0644]
libgcc/ChangeLog
libgcc/config/rs6000/ibm-ldouble.c

index c1a0f54..2fea78d 100644 (file)
@@ -1,3 +1,7 @@
+2013-12-03  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
+       * gcc.target/powerpc/pr57363.c: New test.
+
 2013-12-03  Wei Mi  <wmi@google.com>
 
        PR rtl-optimization/59020
diff --git a/gcc/testsuite/gcc.target/powerpc/pr57363.c b/gcc/testsuite/gcc.target/powerpc/pr57363.c
new file mode 100644 (file)
index 0000000..45ea3f3
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-options "-mlong-double-128" } */
+
+/* Check if adding a qNAN and a normal long double does not generate a
+   inexact exception.  */
+
+#define _GNU_SOURCE
+#include <fenv.h>
+
+int main(void)
+{
+  double x = __builtin_nan ("");
+  long double y = 1.1L;
+
+  feenableexcept (FE_INEXACT);
+  feclearexcept (FE_ALL_EXCEPT);
+  x = x + y;
+  return fetestexcept(FE_INEXACT);
+}
index 32705bf..fea1c05 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-03  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
+       * config/rs6000/ibm-ldouble.c (__gcc_qadd): Fix add
+       of normal number and qNaN to not raise an inexact exception.
+
 2013-11-28  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/32/sfp-machine.h (__FP_FRAC_ADDI_4): New macro.
index 28e02e9..7ca900c 100644 (file)
@@ -104,6 +104,8 @@ __gcc_qadd (double a, double aa, double c, double cc)
 
   if (nonfinite (z))
     {
+      if (fabs (z) != inf())
+       return z;
       z = cc + aa + c + a;
       if (nonfinite (z))
        return z;