1 /* This tests for a bug in regstack that was breaking glibc's math library. */ 2 /* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ 3 4 extern void abort (void); 5 6 static __inline double minus_zero(void)7minus_zero (void) 8 { 9 union { double __d; int __i[2]; } __x; 10 __x.__i[0] = 0x0; 11 __x.__i[1] = 0x80000000; 12 return __x.__d; 13 } 14 15 static __inline long double __atan2l(long double __y,long double __x)16__atan2l (long double __y, long double __x) 17 { 18 register long double __value; 19 __asm __volatile__ ("fpatan\n\t" 20 : "=t" (__value) 21 : "0" (__x), "u" (__y) 22 : "st(1)"); 23 return __value; 24 } 25 26 static __inline long double __sqrtl(long double __x)27__sqrtl (long double __x) 28 { 29 register long double __result; 30 __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); 31 return __result; 32 } 33 34 static __inline double asin(double __x)35asin (double __x) 36 { 37 return __atan2l (__x, __sqrtl (1.0 - __x * __x)); 38 } 39 40 int main(void)41main (void) 42 { 43 double x; 44 45 x = minus_zero(); 46 x = asin (x); 47 48 if (x != 0.0) /* actually -0.0, but 0.0 == -0.0 */ 49 abort (); 50 return 0; 51 } 52