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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [slp-13-big-array.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-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 64
7
volatile int y = 0;
8
 
9
int
10
main1 ()
11
{
12
  int i;
13
  unsigned short out[N*8];
14
  unsigned short in[N*8];
15
  unsigned int in2[N*8];
16
  unsigned int out2[N*8];
17
 
18
  for (i = 0; i < N*8; i++)
19
    {
20
      in[i] = in2[i] = i;
21
      if (y) /* Avoid vectorization.  */
22
        abort ();
23
    }
24
 
25
  /* Induction is not SLPable yet.  */
26
  for (i = 0; i < N; i++)
27
    {
28
      out[i*8] = in[i*8] + i;
29
      out[i*8 + 1] = in[i*8 + 1] + i;
30
      out[i*8 + 2] = in[i*8 + 2] + i;
31
      out[i*8 + 3] = in[i*8 + 3] + i;
32
      out[i*8 + 4] = in[i*8 + 4] + i;
33
      out[i*8 + 5] = in[i*8 + 5] + i;
34
      out[i*8 + 6] = in[i*8 + 6] + i;
35
      out[i*8 + 7] = in[i*8 + 7] + i;
36
    }
37
 
38
  /* check results:  */
39
  for (i = 0; i < N; i++)
40
    {
41
      if (out[i*8] !=  in[i*8] + i
42
         || out[i*8 + 1] != in[i*8 + 1] + i
43
         || out[i*8 + 2] != in[i*8 + 2] + i
44
         || out[i*8 + 3] != in[i*8 + 3] + i
45
         || out[i*8 + 4] != in[i*8 + 4] + i
46
         || out[i*8 + 5] != in[i*8 + 5] + i
47
         || out[i*8 + 6] != in[i*8 + 6] + i
48
         || out[i*8 + 7] != in[i*8 + 7] + i)
49
        abort ();
50
    }
51
 
52
  /* Induction is not SLPable yet and strided group size must be a power of 2
53
     to get vectorized.  */
54
  for (i = 0; i < N/2; i++)
55
    {
56
      out2[i*12] = in2[i*12] + i;
57
      out2[i*12 + 1] = in2[i*12 + 1] + i;
58
      out2[i*12 + 2] = in2[i*12 + 2] + i;
59
      out2[i*12 + 3] = in2[i*12 + 3] + i;
60
      out2[i*12 + 4] = in2[i*12 + 4] + i;
61
      out2[i*12 + 5] = in2[i*12 + 5] + i;
62
      out2[i*12 + 6] = in2[i*12 + 6] + i;
63
      out2[i*12 + 7] = in2[i*12 + 7] + i;
64
      out2[i*12 + 8] = in2[i*12 + 8] + i;
65
      out2[i*12 + 9] = in2[i*12 + 9] + i;
66
      out2[i*12 + 10] = in2[i*12 + 10] + i;
67
      out2[i*12 + 11] = in2[i*12 + 11] + i;
68
    }
69
 
70
  /* check results:  */
71
  for (i = 0; i < N/2; i++)
72
    {
73
        if (out2[i*12] != in2[i*12] + i
74
            || out2[i*12 + 1] != in2[i*12 + 1] + i
75
            || out2[i*12 + 2] != in2[i*12 + 2] + i
76
            || out2[i*12 + 3] != in2[i*12 + 3] + i
77
            || out2[i*12 + 4] != in2[i*12 + 4] + i
78
            || out2[i*12 + 5] != in2[i*12 + 5] + i
79
            || out2[i*12 + 6] != in2[i*12 + 6] + i
80
            || out2[i*12 + 7] != in2[i*12 + 7] + i
81
            || out2[i*12 + 8] != in2[i*12 + 8] + i
82
            || out2[i*12 + 9] != in2[i*12 + 9] + i
83
            || out2[i*12 + 10] != in2[i*12 + 10] + i
84
            || out2[i*12 + 11] != in2[i*12 + 11] + i)
85
          abort ();
86
    }
87
 
88
  /* Not power of 2 but SLPable.  */
89
  for (i = 0; i < N/2; i++)
90
    {
91
      out2[i*12] = in2[i*12] + 1;
92
      out2[i*12 + 1] = in2[i*12 + 1] + 2;
93
      out2[i*12 + 2] = in2[i*12 + 2] + 3;
94
      out2[i*12 + 3] = in2[i*12 + 3] + 4;
95
      out2[i*12 + 4] = in2[i*12 + 4] + 5;
96
      out2[i*12 + 5] = in2[i*12 + 5] + 6;
97
      out2[i*12 + 6] = in2[i*12 + 6] + 7;
98
      out2[i*12 + 7] = in2[i*12 + 7] + 8;
99
      out2[i*12 + 8] = in2[i*12 + 8] + 9;
100
      out2[i*12 + 9] = in2[i*12 + 9] + 10;
101
      out2[i*12 + 10] = in2[i*12 + 10] + 11;
102
      out2[i*12 + 11] = in2[i*12 + 11] + 12;
103
    }
104
 
105
  /* check results:  */
106
  for (i = 0; i < N/2; i++)
107
    {
108
        if (out2[i*12] != in2[i*12] + 1
109
            || out2[i*12 + 1] != in2[i*12 + 1] + 2
110
            || out2[i*12 + 2] != in2[i*12 + 2] + 3
111
            || out2[i*12 + 3] != in2[i*12 + 3] + 4
112
            || out2[i*12 + 4] != in2[i*12 + 4] + 5
113
            || out2[i*12 + 5] != in2[i*12 + 5] + 6
114
            || out2[i*12 + 6] != in2[i*12 + 6] + 7
115
            || out2[i*12 + 7] != in2[i*12 + 7] + 8
116
            || out2[i*12 + 8] != in2[i*12 + 8] + 9
117
            || out2[i*12 + 9] != in2[i*12 + 9] + 10
118
            || out2[i*12 + 10] != in2[i*12 + 10] + 11
119
            || out2[i*12 + 11] != in2[i*12 + 11] + 12)
120
          abort ();
121
    }
122
 
123
 
124
 
125
  return 0;
126
}
127
 
128
int main (void)
129
{
130
  check_vect ();
131
 
132
  main1 ();
133
 
134
  return 0;
135
}
136
 
137
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
138
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { xfail *-*-* }  } } */
139
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
140
/* { dg-final { cleanup-tree-dump "vect" } } */
141
 

powered by: WebSVN 2.1.0

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