annotate gcc/testsuite/gcc.dg/vect/pr20122.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-require-effective-target vect_int } */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 #include <stdarg.h>
kono
parents:
diff changeset
4 #include "tree-vect.h"
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 short Kernshort[24] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
kono
parents:
diff changeset
7 static void VecBug(short Kernel[8][24]) __attribute__((noinline));
kono
parents:
diff changeset
8 static void VecBug2(short Kernel[8][24]) __attribute__((noinline));
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 /* Kernel may alias Kernshort - a global array.
kono
parents:
diff changeset
11 Use versioning for aliasing. */
kono
parents:
diff changeset
12 static void VecBug(short Kernel[8][24])
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 int k,i;
kono
parents:
diff changeset
15 for (k = 0; k<8; k++)
kono
parents:
diff changeset
16 for (i = 0; i<24; i++)
kono
parents:
diff changeset
17 Kernshort[i] = Kernel[k][i];
kono
parents:
diff changeset
18 }
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 /* Vectorizable: Kernshort2 is local. */
kono
parents:
diff changeset
21 static void VecBug2(short Kernel[8][24])
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 int k,i;
kono
parents:
diff changeset
24 short Kernshort2[24] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
kono
parents:
diff changeset
25 for (k = 0; k<8; k++)
kono
parents:
diff changeset
26 for (i = 0; i<24; i++)
kono
parents:
diff changeset
27 Kernshort2[i] = Kernel[k][i];
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 for (k = 0; k<8; k++)
kono
parents:
diff changeset
30 for (i = 0; i<24; i++)
kono
parents:
diff changeset
31 if (Kernshort2[i] != Kernel[k][i])
kono
parents:
diff changeset
32 abort ();
kono
parents:
diff changeset
33 }
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 int main (int argc, char **argv)
kono
parents:
diff changeset
36 {
kono
parents:
diff changeset
37 check_vect ();
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 short Kernel[8][24];
kono
parents:
diff changeset
40 int k,i;
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 for (k = 0; k<8; k++)
kono
parents:
diff changeset
43 for (i = 0; i<24; i++)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 Kernel[k][i] = 0;
kono
parents:
diff changeset
46 /* Don't get into the game of versioning vs. peeling. */
kono
parents:
diff changeset
47 __asm__ volatile ("" : : : "memory");
kono
parents:
diff changeset
48 }
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 VecBug(Kernel);
kono
parents:
diff changeset
51 VecBug2(Kernel);
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 return 0;
kono
parents:
diff changeset
54 }
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 /* The loops in VecBug and VecBug2 require versioning for alignment. */
kono
parents:
diff changeset
57 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
kono
parents:
diff changeset
58 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */