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]

rs6000 long double testcase for fp->int rounding


This is the testcase for the rs6000 fix_trunctfsi2 pattern.

Tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/rs6000-longdouble-rinttest.patch==========
2004-01-09  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/rs6000-ldouble-1.c: New.

Index: testsuite/gcc.dg/rs6000-ldouble-1.c
===================================================================
RCS file: testsuite/gcc.dg/rs6000-ldouble-1.c
diff -N testsuite/gcc.dg/rs6000-ldouble-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/rs6000-ldouble-1.c	10 Jan 2004 05:50:02 -0000
@@ -0,0 +1,23 @@
+/* { dg-do run { target powerpc*-*-darwin* powerpc*-*-aix* powerpc64-*-linux rs6000-*-* } } */
+/* { dg-options "-mlong-double-128" } */
+
+/* Check that long double values are rounded correctly when being converted
+   to 32-bit integers.  All these values are of the form +/- 2 +/- 2^-60.  */
+
+int main(void)
+{
+  long double l1 = 1.9999999999999999991326382620115964527941L;
+  long double l2 = 2.0000000000000000008673617379884035472059L;
+  long double l3 = -2.0000000000000000008673617379884035472059L;
+  long double l4 = -1.9999999999999999991326382620115964527941L;
+  
+  if ((int) l1 != 1)
+    abort ();
+  if ((int) l2 != 2)
+    abort ();
+  if ((int) l3 != -2)
+    abort ();
+  if ((int) l4 != -1)
+    abort ();
+  exit (0);
+}
============================================================


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