OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [20020523-1.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* PR target/6753
2
   This testcase was miscompiled because sse_mov?fcc_const0*
3
   patterns were missing earlyclobber.  */
4
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
5
/* { dg-skip-if "" { ilp32 } { "-fpic" "-fPIC" } { "" } } */
6
/* { dg-require-effective-target ilp32 } */
7
/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
8
 
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
  int fl1, fl2;
33
 
34
  /* See if we can use cpuid.  */
35
  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
36
           "pushl %0; popfl; pushfl; popl %0; popfl"
37
           : "=&r" (fl1), "=&r" (fl2)
38
           : "i" (0x00200000));
39
  if (((fl1 ^ fl2) & 0x00200000) == 0)
40
    exit (0);
41
 
42
  /* See if cpuid gives capabilities.  */
43
  __asm__ ("cpuid" : "=a" (fl1) : "0" (0) : "ebx", "ecx", "edx", "cc");
44
  if (fl1 == 0)
45
    exit (0);
46
 
47
  /* See if capabilities include SSE (25th bit; 26 for SSE2).  */
48
  __asm__ ("cpuid" : "=a" (fl1), "=d" (fl2) : "0" (1) : "ebx", "ecx", "cc");
49
  if ((fl2 & (1 << 25)) == 0)
50
    exit (0);
51
}
52
 
53
int main (void)
54
{
55
  int i;
56
  T x[1];
57
 
58
  bail_if_no_sse ();
59
  for (i = 0; i < 1; i++)
60
    {
61
      x[i].t = foo ();
62
      x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
63
      bar (x[i].t);
64
    }
65
 
66
  exit (0);
67
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.