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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [slp-20.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 128 
7
 
8
int
9
main1 (unsigned short a0, unsigned short a1, unsigned short a2,
10
       unsigned short a3, unsigned short a4, unsigned short a5,
11
       unsigned short a6, unsigned short a7, unsigned short a8)
12
{
13
  int i;
14
  unsigned short out[N*8], out2[N*8], b0, b1, b2, b3, b4, b5, b6, b7, b8;
15
 
16
  for (i = 0; i < N; i++)
17
    {
18
      b0 = a0 + 8;
19
      b1 = a1 + 7;
20
      b2 = a2 + 6;
21
      b3 = a3 + 5;
22
      b4 = a4 + 4;
23
      b5 = a5 + 3;
24
 
25
      out[i*4] = b0;
26
      out[i*4 + 1] = b1;
27
      out[i*4 + 2] = b2;
28
      out[i*4 + 3] = b3;
29
 
30
      out2[i*4] = b0;
31
      out2[i*4 + 1] = b1;
32
      out2[i*4 + 2] = b4;
33
      out2[i*4 + 3] = b5;
34
    }
35
 
36
  /* check results:  */
37
  for (i = 0; i < N; i++)
38
    {
39
      if (out[i*4] != b0
40
         || out[i*4 + 1] != b1
41
         || out[i*4 + 2] != b2
42
         || out[i*4 + 3] != b3)
43
        abort ();
44
 
45
      if (out2[i*4] != b0
46
         || out2[i*4 + 1] != b1
47
         || out2[i*4 + 2] != b4
48
         || out2[i*4 + 3] != b5)
49
        abort ();
50
    }
51
 
52
  for (i = 0; i < N; i++)
53
    {
54
      b0 = a0 + 8;
55
      b1 = a1 + 7;
56
      b2 = a2 + 6;
57
      b3 = a3 + 5;
58
      b4 = a4 + 4;
59
      b5 = a5 + 3;
60
      b6 = a6 + 2;
61
      b7 = a7 + 1;
62
      b8 = a8 + 9;
63
 
64
      out[i*4] = b0;
65
      out[i*4 + 1] = b1;
66
      out[i*4 + 2] = b2;
67
      out[i*4 + 3] = b3;
68
 
69
      out2[i*8] = b0;
70
      out2[i*8 + 1] = b1;
71
      out2[i*8 + 2] = b4;
72
      out2[i*8 + 3] = b5;
73
      out2[i*8 + 4] = b6;
74
      out2[i*8 + 5] = b2;
75
      out2[i*8 + 6] = b7;
76
      out2[i*8 + 7] = b8;
77
    }
78
 
79
  /* check results:  */
80
  for (i = 0; i < N; i++)
81
    {
82
      if (out[i*4] != b0
83
         || out[i*4 + 1] != b1
84
         || out[i*4 + 2] != b2
85
         || out[i*4 + 3] != b3)
86
        abort ();
87
 
88
      if (out2[i*8] != b0
89
         || out2[i*8 + 1] != b1
90
         || out2[i*8 + 2] != b4
91
         || out2[i*8 + 3] != b5
92
         || out2[i*8 + 4] != b6
93
         || out2[i*8 + 5] != b2
94
         || out2[i*8 + 6] != b7
95
         || out2[i*8 + 7] != b8)
96
        abort ();
97
    }
98
 
99
 
100
  return 0;
101
}
102
 
103
int main (void)
104
{
105
  check_vect ();
106
 
107
  main1 (8,7,6,5,4,3,2,1,0);
108
 
109
  return 0;
110
}
111
 
112
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"  } } */
113
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect"  } } */
114
/* { dg-final { cleanup-tree-dump "vect" } } */
115
 

powered by: WebSVN 2.1.0

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