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-5.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
  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 short ia[N];
16
  unsigned int ib[N*2];
17
 
18
  /* Multiple types with SLP of the smaller type.  */
19
  for (i = 0; i < N; i++)
20
    {
21
      out[i*8] = in[i*8];
22
      out[i*8 + 1] = in[i*8 + 1];
23
      out[i*8 + 2] = in[i*8 + 2];
24
      out[i*8 + 3] = in[i*8 + 3];
25
      out[i*8 + 4] = in[i*8 + 4];
26
      out[i*8 + 5] = in[i*8 + 5];
27
      out[i*8 + 6] = in[i*8 + 6];
28
      out[i*8 + 7] = in[i*8 + 7];
29
 
30
      ia[i] = 7;
31
    }
32
 
33
  /* check results:  */
34
  for (i = 0; i < N; i++)
35
    {
36
      if (out[i*8] !=  in[i*8]
37
         || out[i*8 + 1] != in[i*8 + 1]
38
         || out[i*8 + 2] != in[i*8 + 2]
39
         || out[i*8 + 3] != in[i*8 + 3]
40
         || out[i*8 + 4] != in[i*8 + 4]
41
         || out[i*8 + 5] != in[i*8 + 5]
42
         || out[i*8 + 6] != in[i*8 + 6]
43
         || out[i*8 + 7] != in[i*8 + 7]
44
         || ia[i] != 7)
45
        abort ();
46
    }
47
 
48
  for (i = 0; i < N*2; i++)
49
    {
50
      out[i*4] = in[i*4];
51
      out[i*4 + 1] = in[i*4 + 1];
52
      out[i*4 + 2] = in[i*4 + 2];
53
      out[i*4 + 3] = in[i*4 + 3];
54
 
55
      ib[i] = 12;
56
    }
57
 
58
  /* check results:  */
59
  for (i = 0; i < N*2; i++)
60
    {
61
      if (out[i*4] !=  in[i*4]
62
         || out[i*4 + 1] != in[i*4 + 1]
63
         || out[i*4 + 2] != in[i*4 + 2]
64
         || out[i*4 + 3] != in[i*4 + 3]
65
         || ib[i] != 12)
66
        abort ();
67
    }
68
 
69
  for (i = 0; i < N/2; i++)
70
    {
71
      out[i*16] = in[i*16];
72
      out[i*16 + 1] = in[i*16 + 1];
73
      out[i*16 + 2] = in[i*16 + 2];
74
      out[i*16 + 3] = in[i*16 + 3];
75
      out[i*16 + 4] = in[i*16 + 4];
76
      out[i*16 + 5] = in[i*16 + 5];
77
      out[i*16 + 6] = in[i*16 + 6];
78
      out[i*16 + 7] = in[i*16 + 7];
79
      out[i*16 + 8] = in[i*16 + 8];
80
      out[i*16 + 9] = in[i*16 + 9];
81
      out[i*16 + 10] = in[i*16 + 10];
82
      out[i*16 + 11] = in[i*16 + 11];
83
      out[i*16 + 12] = in[i*16 + 12];
84
      out[i*16 + 13] = in[i*16 + 13];
85
      out[i*16 + 14] = in[i*16 + 14];
86
      out[i*16 + 15] = in[i*16 + 15];
87
    }
88
 
89
  /* check results:  */
90
  for (i = 0; i < N/2; i++)
91
    {
92
      if (out[i*16] !=  in[i*16]
93
         || out[i*16 + 1] != in[i*16 + 1]
94
         || out[i*16 + 2] != in[i*16 + 2]
95
         || out[i*16 + 3] != in[i*16 + 3]
96
         || out[i*16 + 4] != in[i*16 + 4]
97
         || out[i*16 + 5] != in[i*16 + 5]
98
         || out[i*16 + 6] != in[i*16 + 6]
99
         || out[i*16 + 7] != in[i*16 + 7]
100
         || out[i*16 + 8] != in[i*16 + 8]
101
         || out[i*16 + 9] != in[i*16 + 9]
102
         || out[i*16 + 10] != in[i*16 + 10]
103
         || out[i*16 + 11] != in[i*16 + 11]
104
         || out[i*16 + 12] != in[i*16 + 12]
105
         || out[i*16 + 13] != in[i*16 + 13]
106
         || out[i*16 + 14] != in[i*16 + 14]
107
         || out[i*16 + 15] != in[i*16 + 15])
108
        abort ();
109
    }
110
 
111
 
112
  return 0;
113
}
114
 
115
int main (void)
116
{
117
  check_vect ();
118
 
119
  main1 ();
120
 
121
  return 0;
122
}
123
 
124
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
125
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect"  } } */
126
/* { dg-final { cleanup-tree-dump "vect" } } */
127
 

powered by: WebSVN 2.1.0

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