Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c

raw
1 /* { dg-do run { target vect_cmdline_needed } } */
2 /* { dg-do compile { target { loongarch_sx && {! loongarch_sx_hw } } } } */
3 /* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic" } */
4 /* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic -mno-sse" { target { i?86-*-* x86_64-*-* } } } */
5 /* { dg-additional-options "-mlsx" { target { loongarch*-*-* } } } */
6
7 #include <stdlib.h>
8
9 #define N 128
10
11 #if __LONG_MAX__ == 2147483647
12 typedef short half_word;
13 #else
14 typedef int half_word;
15 #endif
16
17 int main_1 (int n, int *p)
18 {
19 int i;
20 half_word ib[N];
21 half_word ia[N];
22 int k;
23
24 for (i = 0; i < N; i++)
25 {
26 ia[i] = n;
27 }
28
29 /* check results: */
30 #pragma GCC novector
31 for (i = 0; i < N; i++)
32 {
33 if (ia[i] != n)
34 abort ();
35 }
36
37 k = *p;
38 for (i = 0; i < N; i++)
39 {
40 ib[i] = k;
41 }
42
43 /* check results: */
44 #pragma GCC novector
45 for (i = 0; i < N; i++)
46 {
47 if (ib[i] != k)
48 abort ();
49 }
50
51 return 0;
52 }
53
54 static volatile int n = 1;
55
56 int main (void)
57 {
58 return main_1 (n + 2, (int *) &n);
59 }
60
61 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { avr-*-* msp430-*-* pru-*-* } } } } } */
62 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* msp430-*-* pru-*-* } } } } } */