OSDN Git Service

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