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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [tm/] [20111206.c] - Blame information for rev 686

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-fgnu-tm -O2" } */
3
/* This test case triggered block sharing between the two transactions.  */
4
 
5
void func1 (void) __attribute__ ((transaction_callable, used));
6
long func2 (void) __attribute__ ((transaction_callable, used));
7
unsigned long rand (void);
8
 
9
void client_run (void)
10
{
11
  long types[100];
12
  long i;
13
 
14
  for (i = 0; i < 100; i++)
15
    {
16
      long action = rand ();
17
 
18
      switch (action)
19
        {
20
        case 0:
21
          {
22
            __transaction_relaxed
23
            {
24
              long bill = func2 ();
25
              if (bill >= 0)
26
                {
27
                  func1 ();
28
                }
29
            }
30
            break;
31
          }
32
 
33
        case 1:
34
          {
35
            long n;
36
            __transaction_relaxed
37
            {
38
              for (n = 0; n < 100; n++)
39
                {
40
                  long t = types[n];
41
                  switch (t)
42
                    {
43
                    case 0:
44
                      func1 ();
45
                      break;
46
                    }
47
                }
48
            }
49
            break;
50
          }
51
        }
52
    }
53
}

powered by: WebSVN 2.1.0

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