OSDN Git Service

8321530cd54588cd4d0ae7a7ac6d57c4fdf09760
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / 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 } */
5 /* { dg-require-effective-target ilp32 } */
6 /* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
7
8 #include "../../gcc.dg/i386-cpuid.h"
9 extern void abort (void);
10 extern void exit (int);
11
12 float one = 1.f;
13
14 void bar (float f)
15 {
16   if (__builtin_memcmp (&one, &f, sizeof (float)))
17     abort ();
18 }
19
20 float foo (void)
21 {
22   return 1.f;
23 }
24
25 typedef struct
26 {
27   float t;
28 } T;
29
30 void bail_if_no_sse (void)
31 {
32   unsigned int edx;
33   /* See if capabilities include SSE (25th bit; 26 for SSE2).  */
34   edx = i386_cpuid();
35   if (!(edx & bit_SSE))
36     exit (0);
37 }
38
39 int main (void)
40 {
41   int i;
42   T x[1];
43
44   bail_if_no_sse ();
45   for (i = 0; i < 1; i++)
46     {
47       x[i].t = foo ();
48       x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
49       bar (x[i].t);
50     }
51
52   exit (0);
53 }