i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-23.c
blob8836acf03306742605734342aa09bb2d7893694d
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 128
10 typedef struct {
11 int a;
12 int b;
13 int c;
14 int d;
15 int e;
16 int f;
17 int g;
18 int h;
19 } s;
21 int
22 main1 (s *arr)
24 int i;
25 s *ptr = arr;
26 s res[N];
28 for (i = 0; i < N; i++)
30 res[i].c = ptr->c + ptr->c;
31 res[i].a = ptr->a + ptr->a;
32 res[i].d = ptr->d + ptr->d;
33 res[i].b = ptr->b + ptr->b;
34 res[i].f = ptr->f + ptr->f;
35 res[i].e = ptr->e + ptr->e;
36 res[i].h = ptr->h + ptr->h;
37 res[i].g = ptr->g + ptr->g;
38 ptr++;
41 /* check results: */
42 #pragma GCC novector
43 for (i = 0; i < N; i++)
45 if (res[i].c != arr[i].c + arr[i].c
46 || res[i].a != arr[i].a + arr[i].a
47 || res[i].d != arr[i].d + arr[i].d
48 || res[i].b != arr[i].b + arr[i].b
49 || res[i].f != arr[i].f + arr[i].f
50 || res[i].e != arr[i].e + arr[i].e
51 || res[i].h != arr[i].h + arr[i].h
52 || res[i].g != arr[i].g + arr[i].g)
53 abort();
56 ptr = arr;
57 for (i = 0; i < N; i++)
59 res[i].c = ptr->c + ptr->c;
60 res[i].a = ptr->a + ptr->a;
61 res[i].d = ptr->d + ptr->d;
62 res[i].b = ptr->b + ptr->b;
63 res[i].f = ptr->f + ptr->f;
64 res[i].e = ptr->e + ptr->e;
65 res[i].h = ptr->e + ptr->e;
66 res[i].g = ptr->g + ptr->g;
67 ptr++;
70 /* check results: */
71 #pragma GCC novector
72 for (i = 0; i < N; i++)
74 if (res[i].c != arr[i].c + arr[i].c
75 || res[i].a != arr[i].a + arr[i].a
76 || res[i].d != arr[i].d + arr[i].d
77 || res[i].b != arr[i].b + arr[i].b
78 || res[i].f != arr[i].f + arr[i].f
79 || res[i].e != arr[i].e + arr[i].e
80 || res[i].h != arr[i].e + arr[i].e
81 || res[i].g != arr[i].g + arr[i].g)
82 abort();
87 int main (void)
89 int i;
90 s arr[N];
92 check_vect ();
94 for (i = 0; i < N; i++)
96 arr[i].a = i;
97 arr[i].b = i * 2;
98 arr[i].c = 17;
99 arr[i].d = i+34;
100 arr[i].e = i * 3 + 5;
101 arr[i].f = i * 5;
102 arr[i].g = i - 3;
103 arr[i].h = 56;
104 asm volatile ("" ::: "memory");
107 main1 (arr);
109 return 0;
112 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_strided8 && { ! { vect_no_align} } } } } } */
113 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided8 || vect_no_align } } } } } */
114 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect_perm } } } } */
115 /* SLP fails for the second loop with variable-length SVE because
116 the load size is greater than the minimum vector size. */
117 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm xfail { { aarch64_sve || riscv_v } && vect_variable_length } } } } */