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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c/] [loop-7.c] - Blame information for rev 735

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
/* { dg-do run } */
2
 
3
#include <omp.h>
4
 
5
extern void abort (void);
6
 
7
#define LLONG_MAX __LONG_LONG_MAX__
8
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
9
#define INT_MAX __INT_MAX__
10
 
11
int v;
12
 
13
int
14
test1 (void)
15
{
16
  int e = 0, cnt = 0;
17
  long long i;
18
  unsigned long long j;
19
  char buf[6], *p;
20
 
21
  #pragma omp for schedule(dynamic,1) collapse(2) nowait
22
  for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
23
    for (j = 20; j <= LLONG_MAX - 70; j += LLONG_MAX + 50ULL)
24
      if ((i != LLONG_MAX - 30001
25
           && i != LLONG_MAX - 20001
26
           && i != LLONG_MAX - 10001)
27
          || j != 20)
28
        e = 1;
29
      else
30
        cnt++;
31
  if (e || cnt != 3)
32
    abort ();
33
  else
34
    cnt = 0;
35
 
36
  #pragma omp for schedule(guided,1) collapse(2) nowait
37
  for (i = -LLONG_MAX + 30000; i >= -LLONG_MAX + 10000; i -= 10000)
38
    for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
39
      if ((i != -LLONG_MAX + 30000
40
           && i != -LLONG_MAX + 20000
41
           && i != -LLONG_MAX + 10000)
42
          || j != ULLONG_MAX - 3)
43
        e = 1;
44
      else
45
        cnt++;
46
  if (e || cnt != 3)
47
    abort ();
48
  else
49
    cnt = 0;
50
 
51
  #pragma omp for schedule(static,1) collapse(2) nowait
52
  for (i = LLONG_MAX - 30001; i <= LLONG_MAX - 10001; i += 10000)
53
    for (j = 20; j <= LLONG_MAX - 70 + v; j += LLONG_MAX + 50ULL)
54
      if ((i != LLONG_MAX - 30001
55
           && i != LLONG_MAX - 20001
56
           && i != LLONG_MAX - 10001)
57
          || j != 20)
58
        e = 1;
59
      else
60
        cnt++;
61
  if (e || cnt != 3)
62
    abort ();
63
  else
64
    cnt = 0;
65
 
66
  #pragma omp for schedule(static) collapse(2) nowait
67
  for (i = -LLONG_MAX + 30000 + v; i >= -LLONG_MAX + 10000; i -= 10000)
68
    for (j = ULLONG_MAX - 3; j >= LLONG_MAX + 70ULL; j -= LLONG_MAX + 50ULL)
69
      if ((i != -LLONG_MAX + 30000
70
           && i != -LLONG_MAX + 20000
71
           && i != -LLONG_MAX + 10000)
72
          || j != ULLONG_MAX - 3)
73
        e = 1;
74
      else
75
        cnt++;
76
  if (e || cnt != 3)
77
    abort ();
78
  else
79
    cnt = 0;
80
 
81
  #pragma omp for schedule(runtime) collapse(2) nowait
82
  for (i = 10; i < 30; i++)
83
    for (p = buf; p <= buf + 4; p += 2)
84
      if (i < 10 || i >= 30 || (p != buf && p != buf + 2 && p != buf + 4))
85
        e = 1;
86
      else
87
        cnt++;
88
  if (e || cnt != 60)
89
    abort ();
90
  else
91
    cnt = 0;
92
 
93
  return 0;
94
}
95
 
96
int
97
main (void)
98
{
99
  if (2 * sizeof (int) != sizeof (long long))
100
    return 0;
101
  asm volatile ("" : "+r" (v));
102
  omp_set_schedule (omp_sched_dynamic, 1);
103
  test1 ();
104
  return 0;
105
}

powered by: WebSVN 2.1.0

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