This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A new test case for PPro
- To: egcs at cygnus dot com
- Subject: A new test case for PPro
- From: hjl at lucon dot org (H.J. Lu)
- Date: Thu, 12 Mar 1998 12:37:11 -0800 (PST)
Hi,
This is a new test case on PPro, which is derived from egcs/f77 on
glibc 2.1.
--
H.J. Lu (hjl@gnu.org)
--
Sat Mar 7 12:33:06 1998 H.J. Lu (hjl@gnu.org)
* gcc.dg/980307-1.c: New to test fp on PPro.
--- /dev/null Wed Dec 31 16:00:00 1969
+++ gcc.dg/980307-1.c Sat Mar 7 12:32:10 1998
@@ -0,0 +1,38 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O2 -mach=pentiumpro" } */
+
+extern __inline double fabs (double __x);
+extern __inline double __expm1 (double __x);
+extern __inline double
+__expm1 (double __x)
+{
+ register double __value, __exponent, __temp;
+ __asm __volatile__
+ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t"
+ "fmul %%st(1) # x * log2(e)\n\t"
+ "fstl %%st(1)\n\t"
+ "frndint # int(x * log2(e))\n\t"
+ "fxch\n\t"
+ "fsub %%st(1) # fract(x * log2(e))\n\t"
+ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
+ "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t"
+ : "=t" (__value), "=u" (__exponent) : "0" (__x));
+ __asm __volatile__
+ ("fscale # 2^int(x * log2(e))\n\t"
+ : "=t" (__temp) : "0" (1.0), "u" (__exponent));
+ __temp -= 1.0;
+ return __temp + __value;
+}
+extern __inline double __sgn1 (double __x);
+extern __inline double
+__sgn1 (double __x)
+{
+ return __x >= 0.0 ? 1.0 : -1.0;
+}
+extern double tanh (double __x);
+double
+tanh (double __x)
+{
+ register double __exm1 = __expm1 (-fabs (__x + __x));
+ return __exm1 / (__exm1 + 2.0) * __sgn1 (-__x);
+}