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

Subversion Repositories openrisc

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

Go to most recent revision | 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
#define DIFF 2558402
9
 
10
 
11
__attribute__ ((noinline))
12
int main1 (float x, float max_result)
13
{
14
  int i;
15
  float b[N];
16
  float c[N];
17
  float diff = 2;
18
  float max = x;
19
  float min = 10;
20
 
21
  for (i=0; i<N; i++)
22
    {
23
      b[i] = i * 3;
24
      c[i] = i;
25
    }
26
 
27
  for (i = 0; i < N; i++) {
28
    diff += (b[i] - c[i]);
29
  }
30
 
31
  for (i = 0; i < N; i++) {
32
    max = max < c[i] ? c[i] : max;
33
  }
34
 
35
  for (i = 0; i < N; i++) {
36
    min = min > c[i] ? c[i] : min;
37
  }
38
 
39
  /* check results:  */
40
  if (diff != DIFF)
41
    abort ();
42
  if (max != max_result)
43
    abort ();
44
  if (min != 0)
45
    abort ();
46
 
47
  return 0;
48
}
49
 
50
int main (void)
51
{
52
  main1 (2000, 2000);
53
  main1 (0, 1599);
54
  return 0;
55
}
56
 
57
 
58
/* need -ffast-math to  parallelize these loops.  */
59
/* { dg-final { scan-tree-dump-times "Detected reduction" 0 "parloops" } } */
60
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops" } } */
61
/* { dg-final { scan-tree-dump-times "FAILED: it is not a part of reduction" 3 "parloops" } } */
62
/* { dg-final { cleanup-tree-dump "parloops" } } */
63
/* { dg-final { cleanup-tree-dump "optimized" } } */

powered by: WebSVN 2.1.0

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