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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [s390/] [pr24624.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* This used to ICE due to a backend problem on s390.  */
2
 
3
/* { dg-do compile } */
4
/* { dg-options "-O1 -mpacked-stack" } */
5
 
6
typedef unsigned int __u32;
7
typedef struct
8
{
9
  volatile int counter;
10
} __attribute__ ((aligned (4))) atomic_t;
11
static __inline__ __attribute__ ((always_inline))
12
     void atomic_inc (volatile atomic_t * v)
13
{
14
  (
15
    {
16
    typeof (v->counter) old_val, new_val;
17
  __asm__ __volatile__ (
18
        "   l     %0,0(%3)\n"
19
        "0: lr    %1,%0\n"
20
        "   ar    %1,%4\n"
21
        "   cs    %0,%1,0(%3)\n"
22
        "   jl    0b":
23
        "=&d" (old_val), "=&d" (new_val), "=m" (((atomic_t *) (v))->counter):
24
        "a" (v), "d" (1), "m" (((atomic_t *) (v))->counter):
25
        "cc", "memory");
26
    });
27
}
28
extern unsigned long volatile __attribute__ ((section (".data"))) jiffies;
29
struct inet_peer
30
{
31
  unsigned long dtime;
32
  atomic_t refcnt;
33
};
34
static volatile int peer_total;
35
int inet_peer_threshold = 65536 + 128;
36
int inet_peer_minttl = 120 * 100;
37
int inet_peer_maxttl = 10 * 60 * 100;
38
static int
39
cleanup_once (unsigned long ttl)
40
{
41
  struct inet_peer *p;
42
  if (p != ((void *) 0))
43
    {
44
      if (((
45
             {
46
             1;}
47
           ) && ((long) (jiffies) - (long) (p->dtime + ttl) < 0)))
48
        {
49
          return -1;
50
        }
51
      atomic_inc (&p->refcnt);
52
    }
53
}
54
struct inet_peer *
55
inet_getpeer (__u32 daddr, int create)
56
{
57
  int i;
58
  int ttl;
59
  if (peer_total >= inet_peer_threshold)
60
    ttl = inet_peer_minttl;
61
  else
62
    ttl =
63
      inet_peer_maxttl - (inet_peer_maxttl -
64
                          inet_peer_minttl) / 100 * peer_total /
65
      inet_peer_threshold * 100;
66
  for (i = 0; i < 30 && !cleanup_once (ttl); i++);
67
}

powered by: WebSVN 2.1.0

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