comparison gcc/testsuite/gcc.dg/vect/pr20122.c @ 111:04ced10e8804

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