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-3.c] - Rev 384

Compare with Previous | Blame | View Log

/* { dg-do compile } */
/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */
 
#include <stdarg.h>
#include <stdlib.h>
 
#define N 1600
 
unsigned int ub[N];
unsigned int uc[N];
 
/* Reduction of unsigned-int.  */
 
__attribute__ ((noinline))
int main1 (int n, int res)
{
  int i;
  unsigned int udiff;
 
  udiff = 0;
  for (i = 0; i < n; i++) {
    udiff += (ub[i] - uc[i]);
  }
 
  /* check results:  */
  if (udiff != res)
    abort ();
 
  return 0;
}
 
__attribute__((noinline))
void init_arrays ()
{
  int i;
 
  for (i=0; i<N; i++)
    {
      ub[i] = i * 3;
      uc[i] = i;
    }
}
 
int main (void)
{ 
  init_arrays ();
  main1 (N, 2558400);
  main1 (N-1, 2555202);
  return 0;
}
 
 
/* { dg-final { scan-tree-dump-times "Detected reduction" 1 "parloops" } } */
/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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