OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [autopar/] [reduc-2.c] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */
3
 
4
#include <stdarg.h>
5
#include <stdlib.h>
6
 
7
#define N 1600
8
#define DIFF 2558400
9
 
10
int b[N];
11
int c[N];
12
 
13
/* Reduction of signed-int.  */
14
 
15
__attribute__ ((noinline))
16
void main1 (int x, int max_result, int min_result)
17
{
18
  int i;
19
  int diff = 0;
20
  int max = x;
21
  int min = x;
22
 
23
  for (i = 0; i < N; i++) {
24
    diff += (b[i] - c[i]);
25
  }
26
 
27
  for (i = 0; i < N; i++) {
28
    max = max < c[i] ? c[i] : max;
29
  }
30
 
31
  for (i = 0; i < N; i++) {
32
    min = min > c[i] ? c[i] : min;
33
  }
34
 
35
  /* check results:  */
36
  if (diff != DIFF)
37
    abort ();
38
  if (max != max_result)
39
    abort ();
40
  if (min != min_result)
41
    abort ();
42
}
43
 
44
 __attribute__((noinline))
45
 void init_arrays ()
46
 {
47
   int i;
48
 
49
   b[0] = 1;
50
   c[0] = 1;
51
   for (i=1; i<N; i++)
52
     {
53
       b[i] = i * 3;
54
       c[i] = i;
55
     }
56
}
57
 
58
int main (void)
59
{
60
  init_arrays ();
61
  main1 (2000, 2000, 1);
62
  main1 (0, 1599, 0);
63
  return 0;
64
}
65
 
66
/* { dg-final { scan-tree-dump-times "Detected reduction" 3 "parloops" } } */
67
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 4 "parloops" } } */
68
/* { dg-final { cleanup-tree-dump "parloops" } } */
69
/* { dg-final { cleanup-tree-dump "optimized" } } */
70
 

powered by: WebSVN 2.1.0

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