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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [autopar/] [reduc-3.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 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
 
9
unsigned int ub[N];
10
unsigned int uc[N];
11
 
12
/* Reduction of unsigned-int.  */
13
 
14
__attribute__ ((noinline))
15
int main1 (int n, int res)
16
{
17
  int i;
18
  unsigned int udiff;
19
 
20
  udiff = 0;
21
  for (i = 0; i < n; i++) {
22
    udiff += (ub[i] - uc[i]);
23
  }
24
 
25
  /* check results:  */
26
  if (udiff != res)
27
    abort ();
28
 
29
  return 0;
30
}
31
 
32
__attribute__((noinline))
33
void init_arrays ()
34
{
35
  int i;
36
 
37
  for (i=0; i<N; i++)
38
    {
39
      ub[i] = i * 3;
40
      uc[i] = i;
41
    }
42
}
43
 
44
int main (void)
45
{
46
  init_arrays ();
47
  main1 (N, 2558400);
48
  main1 (N-1, 2555202);
49
  return 0;
50
}
51
 
52
 
53
/* { dg-final { scan-tree-dump-times "Detected reduction" 1 "parloops" } } */
54
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops" } } */
55
/* { dg-final { cleanup-tree-dump "parloops" } } */
56
/* { dg-final { cleanup-tree-dump "optimized" } } */
57
 

powered by: WebSVN 2.1.0

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