OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20020523-1.c
1 /* PR target/6753
2    This testcase was miscompiled because sse_mov?fcc_const0*
3    patterns were missing earlyclobber.  */
4 /* { dg-do run { target i386-*-* } } */
5 /* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */
6 /* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
7
8 extern void abort (void);
9 extern void exit (int);
10
11 float one = 1.f;
12
13 void bar (float f)
14 {
15   if (__builtin_memcmp (&one, &f, sizeof (float)))
16     abort ();
17 }
18
19 float foo (void)
20 {
21   return 1.f;
22 }
23
24 typedef struct
25 {
26   float t;
27 } T;
28
29 void bail_if_no_sse (void)
30 {
31   int fl1, fl2;
32
33   /* See if we can use cpuid.  */
34   __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
35            "pushl %0; popfl; pushfl; popl %0; popfl"
36            : "=&r" (fl1), "=&r" (fl2)
37            : "i" (0x00200000));
38   if (((fl1 ^ fl2) & 0x00200000) == 0)
39     exit (0);
40
41   /* See if cpuid gives capabilities.  */
42   __asm__ ("cpuid" : "=a" (fl1) : "0" (0) : "ebx", "ecx", "edx", "cc");
43   if (fl1 == 0)
44     exit (0);
45
46   /* See if capabilities include SSE (25th bit; 26 for SSE2).  */
47   __asm__ ("cpuid" : "=a" (fl1), "=d" (fl2) : "0" (1) : "ebx", "ecx", "cc");
48   if ((fl2 & (1 << 25)) == 0)
49     exit (0);
50 }
51
52 int main (void)
53 {
54   int i;
55   T x[1];
56
57   bail_if_no_sse ();
58   for (i = 0; i < 1; i++)
59     {
60       x[i].t = foo ();
61       x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
62       bar (x[i].t);
63     }
64
65   exit (0);
66 }