This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH, powerpc] PR 39769, do not rely on floating point equality when testing estimate instructions


I got tired of these tests always failing, and I dug in and found that the
tests were relying on each powerpc implementation to provide the exact bit
value for two estimate instructions (which by definition aren't exact).  I
changed the tests to check if the value is accurate to 4 decimal digits.

Is this ok to apply?  I would like to apply it to the 4.3 branch as well.  Is
it ok to apply there?

I tested this patch on two different powerpc machines that produce different
results, and the three tests pass on each machine.

2009-04-14  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR testsuite/39769
	* gcc.dg/vmx/3a-04.c (test): Don't rely on floating point equality
	for testing the results of estimate instructions.
	* gcc.dg/vmx/3a-04m.c (test): Ditto.
	* gcc.dg/vmx/3a-05.c (test): Ditto.

Index: gcc/testsuite/gcc.dg/vmx/3a-05.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/3a-05.c	(revision 145781)
+++ gcc/testsuite/gcc.dg/vmx/3a-05.c	(working copy)
@@ -14,9 +14,13 @@ f(vector float a, vector float b, vector
 
 static void test()
 {
-  check(vec_all_eq(f(((vector float){2,3,5,7}),
+  check(vec_all_gt(f(((vector float){2,3,5,7}),
 		     ((vector float){11,13,17,19}),
 		     ((vector float){23,29,31,37})),
-		   ((vector float){16.9092026, 18.7693329, -2.8233242, -92.9472198})),
-		   "f");
+		   ((vector float){16.90, 18.76, -2.83, -92.95}))
+	&& vec_all_lt(f(((vector float){2,3,5,7}),
+		     ((vector float){11,13,17,19}),
+		     ((vector float){23,29,31,37})),
+		   ((vector float){16.91, 18.77, -2.82, -92.94})),
+	"f");
 }
Index: gcc/testsuite/gcc.dg/vmx/3a-04m.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/3a-04m.c	(revision 145781)
+++ gcc/testsuite/gcc.dg/vmx/3a-04m.c	(working copy)
@@ -10,9 +10,13 @@ f(vector float a, vector float b, vector
 
 static void test()
 {
-  check(vec_all_eq(f(((vector float){2,3,5,7}),
+  check(vec_all_gt(f(((vector float){2,3,5,7}),
 		     ((vector float){11,13,17,19}),
 		     ((vector float){23,29,31,37})),
-		   ((vector float){23.1818085, 29.2307587, 32.2940826, 128.368393})),
+		   ((vector float){23.18, 29.23, 32.29, 128.36}))
+	&& vec_all_lt(f(((vector float){2,3,5,7}),
+			((vector float){11,13,17,19}),
+			((vector float){23,29,31,37})),
+		      ((vector float){23.19, 29.24, 32.30, 128.37})),
 	"f");
 }
Index: gcc/testsuite/gcc.dg/vmx/3a-04.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/3a-04.c	(revision 145781)
+++ gcc/testsuite/gcc.dg/vmx/3a-04.c	(working copy)
@@ -10,9 +10,13 @@ f(vector float a, vector float b, vector
 
 static void test()
 {
-  check(vec_all_eq(f(((vector float){2,3,5,7}),
+  check(vec_all_gt(f(((vector float){2,3,5,7}),
 		     ((vector float){11,13,17,19}),
 		     ((vector float){23,29,31,37})),
-		   ((vector float){23.1818085, 29.2307587, 32.2940826, 128.368393})),
+		   ((vector float){23.18, 29.23, 32.29, 128.36}))
+	&& vec_all_lt(f(((vector float){2,3,5,7}),
+			((vector float){11,13,17,19}),
+			((vector float){23,29,31,37})),
+		      ((vector float){23.19, 29.24, 32.30, 128.37})),
 	"f");
 }

-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com


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