1/* { dg-require-effective-target vect_int } */
2
3#include <stdarg.h>
4#include "tree-vect.h"
5
6#define N 32
7
8short sa[N];
9short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
10		16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
11short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
12		16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
13int ia[N];
14int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
15	       0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
16int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
17	       0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
18
19__attribute__ ((noinline))
20int main1 (int n)
21{
22  int i;
23
24  /* Multiple types with different sizes, used in idependent
25     copmutations. Vectorizable.  */
26  for (i = 0; i < n; i++)
27    {
28      sa[i+2] = sb[i] + sc[i];
29      ia[i+1] = ib[i] + ic[i];
30    }
31
32  /* check results:  */
33  for (i = 0; i < n; i++)
34    {
35      if (sa[i+2] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
36	abort ();
37    }
38
39  return 0;
40}
41
42int main2 (int n)
43{
44  int i;
45
46  /* Multiple types with different sizes, used in idependent
47     copmutations. Vectorizable.  */
48  for (i = 0; i < n; i++)
49    {
50      ia[i+1] = ib[i] + ic[i];
51      sa[i] = sb[i] + sc[i];
52    }
53
54  /* check results:  */
55  for (i = 0; i < n; i++)
56    {
57      if (sa[i] != sb[i] + sc[i] || ia[i+1] != ib[i] + ic[i])
58        abort ();
59    }
60
61  return 0;
62}
63
64
65int main (void)
66{
67  check_vect ();
68
69  main1 (N-2);
70  main2 (N-1);
71
72  return 0;
73}
74
75/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_hw_misalign } } } */
76/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_hw_misalign } } } */
77/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 10 "vect" { target vect_hw_misalign } } } */
78/* { dg-final { cleanup-tree-dump "vect" } } */
79
80