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 INSTALLED]: use fabs not __builtin_fabs in gcc.dg/builtins-20.c


Makes it easier to read, IMHO.  Tested by recompiling the testcase with
the appropriate flags with gcc mainline on sparc-sun-solaris2.10

Installed as obvious.

		--Kaveh


2006-11-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* gcc.dg/builtins-20.c: Use fabs, not __builtin_fabs.

diff -rup orig/egcc-SVN20061108/gcc/testsuite/gcc.dg/builtins-20.c egcc-SVN20061108/gcc/testsuite/gcc.dg/builtins-20.c
--- orig/egcc-SVN20061108/gcc/testsuite/gcc.dg/builtins-20.c	2006-10-29 18:43:55.000000000 -0500
+++ egcc-SVN20061108/gcc/testsuite/gcc.dg/builtins-20.c	2006-11-09 09:32:32.128681239 -0500
@@ -15,16 +15,19 @@
 extern double cos (double);
 extern double sin (double);
 extern double tan (double);
+extern double fabs (double);
 extern double hypot (double, double);
 extern double pure (double) __attribute__ ((__pure__));
 extern float cosf (float);
 extern float sinf (float);
 extern float tanf (float);
+extern float fabsf (float);
 extern float hypotf (float, float);
 extern float puref (float) __attribute__ ((__pure__));
 extern long double cosl (long double);
 extern long double sinl (long double);
 extern long double tanl (long double);
+extern long double fabsl (long double);
 extern long double hypotl (long double, long double);
 extern long double purel (long double) __attribute__ ((__pure__));

@@ -62,13 +65,13 @@ void test2(double x, double y)
   if (-sin(x-y) != sin(y-x))
     link_error ();

-  if (hypot (x, 0) != __builtin_fabs(x))
+  if (hypot (x, 0) != fabs(x))
     link_error ();

-  if (hypot (0, x) != __builtin_fabs(x))
+  if (hypot (0, x) != fabs(x))
     link_error ();

-  if (hypot (x, x) != __builtin_fabs(x) * __builtin_sqrt(2))
+  if (hypot (x, x) != fabs(x) * __builtin_sqrt(2))
     link_error ();

   if (hypot (-x, y) != hypot (x, y))
@@ -80,27 +83,25 @@ void test2(double x, double y)
   if (hypot (-x, -y) != hypot (x, y))
     link_error ();

-  if (hypot (__builtin_fabs(x), y) != hypot (x, y))
+  if (hypot (fabs(x), y) != hypot (x, y))
     link_error ();

-  if (hypot (x, __builtin_fabs(y)) != hypot (x, y))
+  if (hypot (x, fabs(y)) != hypot (x, y))
     link_error ();

-  if (hypot (__builtin_fabs(x), __builtin_fabs(y)) != hypot (x, y))
+  if (hypot (fabs(x), fabs(y)) != hypot (x, y))
     link_error ();

-  if (hypot (-__builtin_fabs(-x),
-	     -__builtin_fabs(__builtin_fabs(__builtin_fabs(-y))))
-      != hypot (x, y))
+  if (hypot (-fabs(-x), -fabs(fabs(fabs(-y)))) != hypot (x, y))
     link_error ();

-  if (hypot (-x, 0) != __builtin_fabs(x))
+  if (hypot (-x, 0) != fabs(x))
     link_error ();

-  if (hypot (-x, x) != __builtin_fabs(x) * __builtin_sqrt(2))
+  if (hypot (-x, x) != fabs(x) * __builtin_sqrt(2))
     link_error ();

-  if (hypot (pure(x), -pure(x)) != __builtin_fabs(pure(x)) * __builtin_sqrt(2))
+  if (hypot (pure(x), -pure(x)) != fabs(pure(x)) * __builtin_sqrt(2))
     link_error ();
 }

@@ -138,13 +139,13 @@ void test2f(float x, float y)
   if (-sinf(x-y) != sinf(y-x))
     link_error ();

-  if (hypotf (x, 0) != __builtin_fabsf(x))
+  if (hypotf (x, 0) != fabsf(x))
     link_error ();

-  if (hypotf (0, x) != __builtin_fabsf(x))
+  if (hypotf (0, x) != fabsf(x))
     link_error ();

-  if (hypotf (x, x) != __builtin_fabsf(x) * __builtin_sqrtf(2))
+  if (hypotf (x, x) != fabsf(x) * __builtin_sqrtf(2))
     link_error ();

   if (hypotf (-x, y) != hypotf (x, y))
@@ -156,27 +157,25 @@ void test2f(float x, float y)
   if (hypotf (-x, -y) != hypotf (x, y))
     link_error ();

-  if (hypotf (__builtin_fabsf(x), y) != hypotf (x, y))
+  if (hypotf (fabsf(x), y) != hypotf (x, y))
     link_error ();

-  if (hypotf (x, __builtin_fabsf(y)) != hypotf (x, y))
+  if (hypotf (x, fabsf(y)) != hypotf (x, y))
     link_error ();

-  if (hypotf (__builtin_fabsf(x), __builtin_fabsf(y)) != hypotf (x, y))
+  if (hypotf (fabsf(x), fabsf(y)) != hypotf (x, y))
     link_error ();

-  if (hypotf (-__builtin_fabsf(-x),
-	      -__builtin_fabsf(__builtin_fabsf(__builtin_fabsf(-y))))
-      != hypotf (x, y))
+  if (hypotf (-fabsf(-x), -fabsf(fabsf(fabsf(-y)))) != hypotf (x, y))
     link_error ();

-  if (hypotf (-x, 0) != __builtin_fabsf(x))
+  if (hypotf (-x, 0) != fabsf(x))
     link_error ();

-  if (hypotf (-x, x) != __builtin_fabsf(x) * __builtin_sqrtf(2))
+  if (hypotf (-x, x) != fabsf(x) * __builtin_sqrtf(2))
     link_error ();

-  if (hypotf (puref(x), -puref(x)) != __builtin_fabsf(puref(x)) * __builtin_sqrtf(2))
+  if (hypotf (puref(x), -puref(x)) != fabsf(puref(x)) * __builtin_sqrtf(2))
     link_error ();
 }

@@ -215,13 +214,13 @@ void test2l(long double x, long double y
   if (-sinl(x-y) != sinl(y-x))
     link_error ();

-  if (hypotl (x, 0) != __builtin_fabsl(x))
+  if (hypotl (x, 0) != fabsl(x))
     link_error ();

-  if (hypotl (0, x) != __builtin_fabsl(x))
+  if (hypotl (0, x) != fabsl(x))
     link_error ();

-  if (hypotl (x, x) != __builtin_fabsl(x) * __builtin_sqrtl(2))
+  if (hypotl (x, x) != fabsl(x) * __builtin_sqrtl(2))
     link_error ();

   if (hypotl (-x, y) != hypotl (x, y))
@@ -233,27 +232,25 @@ void test2l(long double x, long double y
   if (hypotl (-x, -y) != hypotl (x, y))
     link_error ();

-  if (hypotl (__builtin_fabsl(x), y) != hypotl (x, y))
+  if (hypotl (fabsl(x), y) != hypotl (x, y))
     link_error ();

-  if (hypotl (x, __builtin_fabsl(y)) != hypotl (x, y))
+  if (hypotl (x, fabsl(y)) != hypotl (x, y))
     link_error ();

-  if (hypotl (__builtin_fabsl(x), __builtin_fabsl(y)) != hypotl (x, y))
+  if (hypotl (fabsl(x), fabsl(y)) != hypotl (x, y))
     link_error ();

-  if (hypotl (-__builtin_fabsl(-x),
-	      -__builtin_fabsl(__builtin_fabsl(__builtin_fabsl(-y))))
-      != hypotl (x, y))
+  if (hypotl (-fabsl(-x), -fabsl(fabsl(fabsl(-y)))) != hypotl (x, y))
     link_error ();

-  if (hypotl (-x, 0) != __builtin_fabsl(x))
+  if (hypotl (-x, 0) != fabsl(x))
     link_error ();

-  if (hypotl (-x, x) != __builtin_fabsl(x) * __builtin_sqrtl(2))
+  if (hypotl (-x, x) != fabsl(x) * __builtin_sqrtl(2))
     link_error ();

-  if (hypotl (purel(x), -purel(x)) != __builtin_fabsl(purel(x)) * __builtin_sqrtl(2))
+  if (hypotl (purel(x), -purel(x)) != fabsl(purel(x)) * __builtin_sqrtl(2))
     link_error ();
 }


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