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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [slp-19.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include <stdio.h>
5
#include "tree-vect.h"
6
 
7
#define N 16 
8
 
9
int
10
main1 ()
11
{
12
  unsigned int i;
13
  unsigned int out[N*8];
14
  unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
15
  unsigned int ia[N*2], a0, a1, a2, a3;
16
 
17
  for (i = 0; i < N; i++)
18
    {
19
      out[i*8] = in[i*8];
20
      out[i*8 + 1] = in[i*8 + 1];
21
      out[i*8 + 2] = in[i*8 + 2];
22
      out[i*8 + 3] = in[i*8 + 3];
23
      out[i*8 + 4] = in[i*8 + 4];
24
      out[i*8 + 5] = in[i*8 + 5];
25
      out[i*8 + 6] = in[i*8 + 6];
26
      out[i*8 + 7] = in[i*8 + 7];
27
 
28
      ia[i] = in[i*8 + 2];
29
    }
30
 
31
  /* check results:  */
32
  for (i = 0; i < N; i++)
33
    {
34
      if (out[i*8] !=  in[i*8]
35
         || out[i*8 + 1] != in[i*8 + 1]
36
         || out[i*8 + 2] != in[i*8 + 2]
37
         || out[i*8 + 3] != in[i*8 + 3]
38
         || out[i*8 + 4] != in[i*8 + 4]
39
         || out[i*8 + 5] != in[i*8 + 5]
40
         || out[i*8 + 6] != in[i*8 + 6]
41
         || out[i*8 + 7] != in[i*8 + 7]
42
         || ia[i] != in[i*8 + 2])
43
        abort ();
44
    }
45
 
46
  for (i = 0; i < N*2; i++)
47
    {
48
      a0 = in[i*4] + 1;
49
      a1 = in[i*4 + 1] + 2;
50
      a2 = in[i*4 + 2] + 3;
51
      a3 = in[i*4 + 3] + 4;
52
 
53
      out[i*4] = a0;
54
      out[i*4 + 1] = a1;
55
      out[i*4 + 2] = a2;
56
      out[i*4 + 3] = a3;
57
 
58
      ia[i] = a2;
59
    }
60
 
61
  /* check results:  */
62
  for (i = 0; i < N*2; i++)
63
    {
64
      if (out[i*4] !=  in[i*4] + 1
65
         || out[i*4 + 1] != in[i*4 + 1] + 2
66
         || out[i*4 + 2] != in[i*4 + 2] + 3
67
         || out[i*4 + 3] != in[i*4 + 3] + 4
68
         || ia[i] != in[i*4 + 2] + 3)
69
        abort ();
70
    }
71
 
72
  /* The last stmt requires interleaving of not power of 2 size - not
73
     vectorizable.  */
74
  for (i = 0; i < N/2; i++)
75
    {
76
      out[i*12] = in[i*12];
77
      out[i*12 + 1] = in[i*12 + 1];
78
      out[i*12 + 2] = in[i*12 + 2];
79
      out[i*12 + 3] = in[i*12 + 3];
80
      out[i*12 + 4] = in[i*12 + 4];
81
      out[i*12 + 5] = in[i*12 + 5];
82
      out[i*12 + 6] = in[i*12 + 6];
83
      out[i*12 + 7] = in[i*12 + 7];
84
      out[i*12 + 8] = in[i*12 + 8];
85
      out[i*12 + 9] = in[i*12 + 9];
86
      out[i*12 + 10] = in[i*12 + 10];
87
      out[i*12 + 11] = in[i*12 + 11];
88
 
89
      ia[i] = in[i*12 + 7];
90
    }
91
 
92
  /* check results:  */
93
  for (i = 0; i < N/2; i++)
94
    {
95
      if (out[i*12] !=  in[i*12]
96
         || out[i*12 + 1] != in[i*12 + 1]
97
         || out[i*12 + 2] != in[i*12 + 2]
98
         || out[i*12 + 3] != in[i*12 + 3]
99
         || out[i*12 + 4] != in[i*12 + 4]
100
         || out[i*12 + 5] != in[i*12 + 5]
101
         || out[i*12 + 6] != in[i*12 + 6]
102
         || out[i*12 + 7] != in[i*12 + 7]
103
         || out[i*12 + 8] != in[i*12 + 8]
104
         || out[i*12 + 9] != in[i*12 + 9]
105
         || out[i*12 + 10] != in[i*12 + 10]
106
         || out[i*12 + 11] != in[i*12 + 11]
107
         || ia[i] != in[i*12 + 7])
108
        abort ();
109
    }
110
 
111
  /* Hybrid SLP with unrolling by 2.  */
112
  for (i = 0; i < N; i++)
113
    {
114
      out[i*6] = in[i*6];
115
      out[i*6 + 1] = in[i*6 + 1];
116
      out[i*6 + 2] = in[i*6 + 2];
117
      out[i*6 + 3] = in[i*6 + 3];
118
      out[i*6 + 4] = in[i*6 + 4];
119
      out[i*6 + 5] = in[i*6 + 5];
120
 
121
      ia[i] = i;
122
    }
123
 
124
  /* check results:  */
125
  for (i = 0; i < N/2; i++)
126
    {
127
      if (out[i*6] !=  in[i*6]
128
         || out[i*6 + 1] != in[i*6 + 1]
129
         || out[i*6 + 2] != in[i*6 + 2]
130
         || out[i*6 + 3] != in[i*6 + 3]
131
         || out[i*6 + 4] != in[i*6 + 4]
132
         || out[i*6 + 5] != in[i*6 + 5]
133
         || ia[i] != i)
134
        abort ();
135
    }
136
 
137
 
138
  return 0;
139
}
140
 
141
int main (void)
142
{
143
  check_vect ();
144
 
145
  main1 ();
146
 
147
  return 0;
148
}
149
 
150
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target  vect_strided_wide  } } } */
151
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target  { ! { vect_strided_wide } } } } } */
152
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect"  { target  vect_strided_wide  } } } */
153
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect"  { target { ! { vect_strided_wide } } } } } */
154
/* { dg-final { cleanup-tree-dump "vect" } } */
155
 

powered by: WebSVN 2.1.0

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