Debian Codegraph @

gcc/testsuite/g++.dg/vect/vect-novector-pragma.cc

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } */
4
5 #include <vector>
6
7 void f4 (std::vector<int> a, std::vector<int> b, int n)
8 {
9 int i = 0;
10 #pragma GCC novector
11 while (i < (n & -8))
12 {
13 a[i] += b[i];
14 i++;
15 }
16 }
17
18 void f5 (std::vector<int> a, std::vector<int> b, int n)
19 {
20 int i = 0;
21 #pragma GCC novector
22 #pragma GCC ivdep
23 #pragma GCC unroll 2
24 while (i < (n & -8))
25 {
26 a[i] += b[i];
27 i++;
28 }
29 }
30
31 void f6 (std::vector<int> a, std::vector<int> b, int n)
32 {
33 int i = 0;
34 #pragma GCC ivdep
35 #pragma GCC novector
36 #pragma GCC unroll 2
37 while (i < (n & -8))
38 {
39 a[i] += b[i];
40 i++;
41 }
42 }
43
44 void f7 (std::vector<int> a, std::vector<int> b, int n)
45 {
46 int i = 0;
47 #pragma GCC ivdep
48 #pragma GCC unroll 2
49 #pragma GCC novector
50 while (i < (n & -8))
51 {
52 a[i] += b[i];
53 i++;
54 }
55 }
56
57 #if __cpp_range_based_for
58 void f8 (std::vector<int> a, std::vector<int> b, int n)
59 {
60 int i = 0;
61 #pragma GCC novector
62 for (int x : b)
63 {
64 a[i] += x;
65 i++;
66 }
67 }
68 #endif
69
70 /* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */