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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20031201-1.c] - Blame information for rev 715

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
   PR target/13256
3
   STRICT_LOW_PART was handled incorrectly in delay slots.
4
   Origin: Hans-Peter Nilsson.  */
5
 
6
typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s1;
7
typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s2;
8
typedef struct { s1 i12; s2 i16; } io;
9
static int test_length = 2;
10
static io *i;
11
static int m = 1;
12
static int d = 1;
13
static unsigned long test_t0;
14
static unsigned long test_t1;
15
void test(void) __attribute__ ((__noinline__));
16
extern int f1 (void *port) __attribute__ ((__noinline__));
17
extern void f0 (void) __attribute__ ((__noinline__));
18
int
19
f1 (void *port)
20
{
21
  int fail_count = 0;
22
  unsigned long tlen;
23
  s1 x0 = {0};
24
  s2 x1 = {0};
25
 
26
  i = port;
27
  x0.e0 = x1.e0 = 32;
28
  i->i12 = x0;
29
  i->i16 = x1;
30
  do f0(); while (test_t1);
31
  x0.e0 = x1.e0 = 8;
32
  i->i12 = x0;
33
  i->i16 = x1;
34
  test ();
35
  if (m)
36
    {
37
      unsigned long e = 1000000000 / 460800 * test_length;
38
      tlen = test_t1 - test_t0;
39
      if (((tlen-e) & 0x7FFFFFFF) > 1000)
40
        f0();
41
    }
42
  if (d)
43
    {
44
      unsigned long e = 1000000000 / 460800 * test_length;
45
      tlen = test_t1 - test_t0;
46
      if (((tlen - e) & 0x7FFFFFFF) > 1000)
47
        f0();
48
    }
49
  return fail_count != 0 ? 1 : 0;
50
}
51
 
52
int
53
main ()
54
{
55
  io io0;
56
  f1 (&io0);
57
  abort ();
58
}
59
 
60
void
61
test (void)
62
{
63
  io *iop = i;
64
  if (iop->i12.e0 != 8 || iop->i16.e0 != 8)
65
    abort ();
66
  exit (0);
67
}
68
 
69
void
70
f0 (void)
71
{
72
  static int washere = 0;
73
  io *iop = i;
74
  if (washere++ || iop->i12.e0 != 32 || iop->i16.e0 != 32)
75
    abort ();
76
}

powered by: WebSVN 2.1.0

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