Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-1.c
blobfd7cacb483d9cfbea6d909ba12e67544fa32a190
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 32
9 short sa[N];
10 short sb[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
11 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
12 int ia[N];
13 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
14 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
16 /* Current peeling-for-alignment scheme will consider the 'sa[i+7]'
17 access for peeling, and therefore will examine the option of
18 using a peeling factor = V-7%V = 1,3 for V=8,4 respectively,
19 which will also align the access to 'ia[i+3]', and the loop could be
20 vectorized on all targets that support unaligned loads. */
22 __attribute__ ((noinline)) int main1 (int n)
24 int i;
26 /* Multiple types with different sizes, used in idependent
27 copmutations. Vectorizable. */
28 for (i = 0; i < n; i++)
30 sa[i+7] = sb[i];
31 ia[i+3] = ib[i+1];
34 /* check results: */
35 for (i = 0; i < n; i++)
37 if (sa[i+7] != sb[i] || ia[i+3] != ib[i+1])
38 abort ();
41 return 0;
44 /* Current peeling-for-alignment scheme will consider the 'ia[i+3]'
45 access for peeling, and therefore will examine the option of
46 using a peeling factor = (V-3)%V = 1 for V=2,4.
47 This will not align the access 'sa[i+3]' (for which we need to
48 peel 5 iterations). However, 'ia[i+3]' also gets aligned if we peel 5
49 iterations, so the loop is vectorizable on all targets that support
50 unaligned loads. */
52 __attribute__ ((noinline)) int main2 (int n)
54 int i;
56 /* Multiple types with different sizes, used in independent
57 copmutations. */
58 for (i = 0; i < n; i++)
60 ia[i+3] = ib[i];
61 sa[i+3] = sb[i+1];
64 /* check results: */
65 for (i = 0; i < n; i++)
67 if (sa[i+3] != sb[i+1] || ia[i+3] != ib[i])
68 abort ();
71 return 0;
74 int main (void)
76 check_vect ();
78 main1 (N-7);
79 main2 (N-3);
81 return 0;
84 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
85 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail {{ vect_no_align && { ! vect_hw_misalign } } || {vect_sizes_32B_16B }}} } } */
86 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail {{ vect_no_align && { ! vect_hw_misalign } } || {vect_sizes_32B_16B }}} } } */