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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-outer-5.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_float } */
2
 
3
#include <stdio.h>
4
#include <stdarg.h>
5
#include <signal.h>
6
#include "tree-vect.h"
7
 
8
#define N 64
9
#define MAX 42
10
 
11
extern void abort(void);
12
 
13
__attribute__ ((noinline))
14
int main1 ()
15
{
16
  float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
17
  float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
18
  float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
19
  float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
20
  float E[4] = {0,1,2,480};
21
  float s;
22
 
23
  int i, j;
24
 
25
  for (i = 0; i < N; i++)
26
    {
27
      A[i] = i;
28
      B[i] = i;
29
      C[i] = i;
30
      D[i] = i;
31
    }
32
 
33
  /* Outer-loop 1: Vectorizable with respect to dependence distance. */
34
  for (i = 0; i < N-20; i++)
35
    {
36
      s = 0;
37
      for (j=0; j<N; j+=4)
38
        s += C[j];
39
      A[i] = A[i+20] + s;
40
    }
41
 
42
  /* check results:  */
43
  for (i = 0; i < N-20; i++)
44
    {
45
      s = 0;
46
      for (j=0; j<N; j+=4)
47
        s += C[j];
48
      if (A[i] != D[i+20] + s)
49
        abort ();
50
    }
51
 
52
  /* Outer-loop 2: Not vectorizable because of dependence distance. */
53
  for (i = 0; i < 4; i++)
54
    {
55
      s = 0;
56
      for (j=0; j<N; j+=4)
57
        s += C[j];
58
      B[i+3] = B[i] + s;
59
    }
60
 
61
  /* check results:  */
62
  for (i = 0; i < 4; i++)
63
    {
64
      if (B[i] != E[i])
65
        abort ();
66
    }
67
 
68
  return 0;
69
}
70
 
71
int main ()
72
{
73
  check_vect ();
74
  return main1();
75
}
76
 
77
/* NOTE: We temporarily xfail the following check until versioning for
78
   aliasing is fixed to avoid versioning when the dependence distance
79
   is known.  */
80
/* { dg-final { scan-tree-dump-times "not vectorized: possible dependence between data-refs" 1 "vect" { xfail *-*-* } } } */
81
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
82
/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" { xfail vect_no_align } } } */
83
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

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