1/* This used to ICE due to a backend problem on s390.  */
2
3/* { dg-do compile } */
4/* { dg-options "-O1 -mpacked-stack" } */
5
6typedef unsigned int __u32;
7typedef struct
8{
9  volatile int counter;
10} __attribute__ ((aligned (4))) atomic_t;
11static __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}
28extern unsigned long volatile __attribute__ ((section (".data"))) jiffies;
29struct inet_peer
30{
31  unsigned long dtime;
32  atomic_t refcnt;
33};
34static volatile int peer_total;
35int inet_peer_threshold = 65536 + 128;
36int inet_peer_minttl = 120 * 100;
37int inet_peer_maxttl = 10 * 60 * 100;
38static int
39cleanup_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}
54struct inet_peer *
55inet_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}
68