OSDN Git Service

PR target/6428
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20030225-2.c
1 /* { dg-do run { target ia64-*-linux* } } */
2 /* { dg-options "-O3" } */
3
4 int __attribute__((noinline, const))
5 ret4 (float value)
6 {
7   return 4;
8 }
9
10 int __attribute__((noinline, const))
11 ret0 (float value)
12 {
13   return 0;
14 }
15
16 float __attribute__((noinline))
17 test (float x, float y)
18 {
19   int clsx = ret4 (x);
20   int clsy = ret0 (y);
21
22   if (clsx == 0 || clsy == 0
23       || (y < 0 && clsx == 1 && clsy == 1))
24     return x - y;
25
26   return x < y ? 0 : x - y;
27 }
28
29 float a = 0.0, b;
30
31 int main (void)
32 {
33   unsigned long e;
34   b = a / a;
35   __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
36   e &= ~0x7e000UL;
37   __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (e) : "memory");
38   a = test (0, b);
39   __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
40   if (e & 0x2000)
41     abort ();
42   exit (0);
43 }