SVE Intrinsics: Change return type of redirect_call to gcall.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-early-break_56.c
blob9096f66647c7b3cb430562d35f8ce076244f7c11
1 /* { dg-add-options vect_early_break } */
2 /* Disabling epilogues until we find a better way to deal with scans. */
3 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
4 /* { dg-require-effective-target vect_int } */
5 /* { dg-add-options bind_pic_locally } */
6 /* { dg-require-effective-target vect_early_break_hw } */
8 #include <stdarg.h>
9 #include "tree-vect.h"
11 #define N 32
13 unsigned short sa[N];
14 unsigned short sc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
15 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
16 unsigned short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
17 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
18 unsigned int ia[N];
19 unsigned int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
20 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
21 unsigned int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
22 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
24 /* Current peeling-for-alignment scheme will consider the 'sa[i+7]'
25 access for peeling, and therefore will examine the option of
26 using a peeling factor = VF-7%VF. This will result in a peeling factor 1,
27 which will also align the access to 'ia[i+3]', and the loop could be
28 vectorized on all targets that support unaligned loads.
29 Without cost model on targets that support misaligned stores, no peeling
30 will be applied since we want to keep the four loads aligned. */
32 __attribute__ ((noinline))
33 int main1 ()
35 int i;
36 int n = N - 7;
38 /* Multiple types with different sizes, used in independent
39 copmutations. Vectorizable. */
40 for (i = 0; i < n; i++)
42 sa[i+7] = sb[i] + sc[i];
43 ia[i+3] = ib[i] + ic[i];
46 /* check results: */
47 for (i = 0; i < n; i++)
49 if (sa[i+7] != sb[i] + sc[i] || ia[i+3] != ib[i] + ic[i])
50 abort ();
53 return 0;
56 /* Current peeling-for-alignment scheme will consider the 'ia[i+3]'
57 access for peeling, and therefore will examine the option of
58 using a peeling factor = VF-3%VF. This will result in a peeling factor
59 1 if VF=4,2. This will not align the access to 'sa[i+3]', for which we
60 need to peel 5,1 iterations for VF=4,2 respectively, so the loop can not
61 be vectorized. However, 'ia[i+3]' also gets aligned if we peel 5
62 iterations, so the loop is vectorizable on all targets that support
63 unaligned loads.
64 Without cost model on targets that support misaligned stores, no peeling
65 will be applied since we want to keep the four loads aligned. */
67 __attribute__ ((noinline))
68 int main2 ()
70 int i;
71 int n = N-3;
73 /* Multiple types with different sizes, used in independent
74 copmutations. Vectorizable. */
75 for (i = 0; i < n; i++)
77 ia[i+3] = ib[i] + ic[i];
78 sa[i+3] = sb[i] + sc[i];
81 /* check results: */
82 for (i = 0; i < n; i++)
84 if (sa[i+3] != sb[i] + sc[i] || ia[i+3] != ib[i] + ic[i])
85 abort ();
88 return 0;
91 int main (void)
93 check_vect ();
95 main1 ();
96 main2 ();
98 return 0;
101 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { xfail { vect_early_break && { ! vect_hw_misalign } } } } } */