This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FP bugs and conditional move


> 
> 	Enabling fp constant conditional move in egcs exposes many egcs bugs in
> 	fp constant handling. One bug is fold_rtx () tries to change
> 	... MEMs into CONST_DOUBLEs...
> 
> Why is this a problem?  The output of fold_rtx is never used unless it is
> a valid instruction for the target, so this should never cause problems.
> 
> The output of fold_rtx is used by cse for value tracking, so it is important
> to simplify RTL as much as possible.  Also, if we disable it for some cases, we
> may find that some optimizations get missed because replacing the MEM with
> a CONST_DOUBLE may have allow the expression to be simplified further into
> something that was valid.
> 

I was wrong. But here are some real test cases. Could you pleae verify
them? I have a patch to fix them.

BTW, I have sent my test cases and my patch to Stan.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Fri Mar 13 08:42:28 1998  H.J. Lu  (hjl@gnu.org)

	* gcc.dg/980313-1.c: New to test fp on PPro.
	* gcc.dg/980313-2.c: Likewise.
	* gcc.dg/980313-3.c: Likewise.
	* gcc.dg/980313-4.c: Likewise.
	* gcc.dg/980313-5.c: Likewise.

--- /dev/null	Wed Dec 31 16:00:00 1969
+++ gcc.dg/980313-1.c	Mon Mar 16 08:47:51 1998
@@ -0,0 +1,21 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+extern __inline  double
+__expm1 (double __x)
+{
+  double __temp;
+  __temp -= 1.0;
+  return __temp;
+}
+extern __inline  double
+__sgn1 (double __x)
+{
+  return __x >= 0.0 ? 1.0 : -1.0;
+}
+double
+tanh (double __x)
+{
+  register double __exm1 = __expm1 (__x);
+  return __exm1 / (__exm1 + 2.0) * __sgn1 (-__x);
+}
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ gcc.dg/980313-2.c	Mon Mar 16 09:21:10 1998
@@ -0,0 +1,21 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+double
+tanh (double __x)
+{
+  double inline __expm1 (double __x)
+  {
+    double __temp;
+    __temp -= 1.0;
+    return __temp;
+  }
+
+  double inline __sgn1 (double __x)
+  {
+    return __x >= 0.0 ? 1.0 : -1.0;
+  }
+
+  double __exm1 = __expm1 (__x);
+  return __exm1 / (__exm1 + 2.0) * __sgn1 (-__x);
+}
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ gcc.dg/980313-3.c	Mon Mar 16 09:21:42 1998
@@ -0,0 +1,19 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+double
+tanh (double __x)
+{
+  double __expm1 (double __x)
+  {
+    double __temp;
+    __temp = 1.0;
+    return __temp;
+  }
+  double __sgn1 (double __x)
+  {
+  return __x >= 0.0 ? 1.0 : -1.0;
+  }
+
+  return  __expm1 (__x) * __sgn1 (-__x);
+}
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ gcc.dg/980313-4.c	Mon Mar 16 09:22:02 1998
@@ -0,0 +1,19 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+double
+tanh (double __x)
+{
+  double inline __expm1 (double __x)
+  {
+    double __temp;
+    __temp = 1.0;
+    return __temp;
+  }
+  double  inline __sgn1 (double __x)
+  {
+  return __x >= 0.0 ? 1.0 : -1.0;
+  }
+
+  return  __expm1 (__x) * __sgn1 (-__x);
+}
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ gcc.dg/980313-5.c	Mon Mar 16 08:47:46 1998
@@ -0,0 +1,20 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -march=pentiumpro" } */
+
+extern __inline  double
+__expm1 (double __x)
+{
+  double __temp;
+  __temp = 1.0;
+  return __temp;
+}
+extern __inline  double
+__sgn1 (double __x)
+{
+  return __x >= 0.0 ? 1.0 : -1.0;
+}
+double
+tanh (double __x)
+{
+  return  __expm1 (__x) * __sgn1 (-__x);
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]