[testcase] FP conditions and ix86 -ffast-math

Gwenole Beauchesne gbeauchesne@mandrakesoft.com
Tue Feb 12 08:48:00 GMT 2002


Hi,

Sorry for the misleading subject. FYI, Jan, with your patch from last
year, <http://gcc.gnu.org/ml/gcc-patches/2001-01/msg00291.html>, you fixed
the following testcase I extracted from gawk/eval.c and probably oaf too.
Bad code used to be generated from "2.96"-RH with "-O2 -mcpu=pentiumpro
-ffast-math". i.e. an fxch was missing thus causing the comparison to
behave strangely. ;-)

I know that's fixed since 3.0 but could you please commit the test so that
we can assure we don't regress on that problem? Thanks.

2002-02-12  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>

	* gcc.dg/20020212-1.c: New test.

--- gcc/testsuite/gcc.dg/20020212-1.c.regstack	Tue Feb 12 16:04:24 2002
+++ gcc/testsuite/gcc.dg/20020212-1.c	Tue Feb 12 16:04:24 2002
@@ -0,0 +1,21 @@
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options "-O2 -mcpu=pentiumpro -ffast-math" } */
+
+static int compare(double t1, double t2)
+{
+  if (t1 == t2)
+	return 0;
+  else if (t1 < t2)
+	return -1;
+  else
+	return +1;
+}
+
+int main(void)
+{
+  if (compare(3.0, 2.0) != 1)
+	abort();
+  if (compare(2.0, 3.0) != -1)
+	abort();
+  return 0;
+}




More information about the Gcc-patches mailing list