| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "-fopenmp -ffat-lto-objects -fdump-tree-gimple" } |
| 3 |
|
| 4 |
extern "C" void abort (); |
| 5 |
|
| 6 |
[[omp::decl (declare simd, linear (l))]] extern int f1 (int l); |
| 7 |
extern int f2 (int), f3 [[omp::decl (declare simd, uniform (m))]] (int m), f4 (int), z; |
| 8 |
[[omp::decl (declare simd, linear (l), simdlen(4))]] extern int f5 [[omp::decl (declare simd uniform (l) simdlen (8) notinbranch)]] (int l); |
| 9 |
|
| 10 |
int |
| 11 |
f1 (int l) |
| 12 |
{ |
| 13 |
return l; |
| 14 |
} |
| 15 |
|
| 16 |
// { dg-final { scan-assembler-times "_ZGVbM4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 17 |
// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 18 |
// { dg-final { scan-assembler-times "_ZGVcM4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 19 |
// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 20 |
// { dg-final { scan-assembler-times "_ZGVdM8l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 21 |
// { dg-final { scan-assembler-times "_ZGVdN8l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 22 |
// { dg-final { scan-assembler-times "_ZGVeM16l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 23 |
// { dg-final { scan-assembler-times "_ZGVeN16l__Z2f1i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 24 |
|
| 25 |
int |
| 26 |
f2 (int l) |
| 27 |
{ |
| 28 |
return l + 1; |
| 29 |
} |
| 30 |
|
| 31 |
// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f2i:" { target { i?86-*-* x86_64-*-* } } } } |
| 32 |
|
| 33 |
int |
| 34 |
f3 (int l) |
| 35 |
{ |
| 36 |
return l + 2; |
| 37 |
} |
| 38 |
|
| 39 |
// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 40 |
// { dg-final { scan-assembler-times "_ZGVbN4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 41 |
// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 42 |
// { dg-final { scan-assembler-times "_ZGVcN4u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 43 |
// { dg-final { scan-assembler-times "_ZGVdM8u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 44 |
// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 45 |
// { dg-final { scan-assembler-times "_ZGVeM16u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 46 |
// { dg-final { scan-assembler-times "_ZGVeN16u__Z2f3i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 47 |
|
| 48 |
int |
| 49 |
f4 (int l) |
| 50 |
{ |
| 51 |
return l + 3; |
| 52 |
} |
| 53 |
|
| 54 |
// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f4i:" { target { i?86-*-* x86_64-*-* } } } } |
| 55 |
|
| 56 |
int |
| 57 |
f5 (int l) |
| 58 |
{ // { dg-warning "GCC does not currently support simdlen 8 for type 'int'" "" { target aarch64*-*-* } .-1 } |
| 59 |
return l + 4; |
| 60 |
} |
| 61 |
|
| 62 |
// { dg-final { scan-assembler-times "_ZGVbM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 63 |
// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 64 |
// { dg-final { scan-assembler-times "_ZGVcM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 65 |
// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 66 |
// { dg-final { scan-assembler-times "_ZGVdM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 67 |
// { dg-final { scan-assembler-times "_ZGVdN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 68 |
// { dg-final { scan-assembler-times "_ZGVeM4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 69 |
// { dg-final { scan-assembler-times "_ZGVeN4l__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 70 |
// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 71 |
// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 72 |
// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 73 |
// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f5i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 74 |
// { dg-final { scan-assembler-not "_ZGV\[bcde]M8u__Z2f5i:" { target { i?86-*-* x86_64-*-* } } } } |
| 75 |
|
| 76 |
[[omp::decl (declare simd, linear (l), simdlen(4), notinbranch), |
| 77 |
omp::decl (declare simd, uniform (l), simdlen(4), inbranch)]] |
| 78 |
int |
| 79 |
f6 [[using omp : decl (declare simd uniform (l) simdlen (8), notinbranch), // { dg-warning "attribute using prefix only available with" "" { target c++14_down } } |
| 80 |
decl (declare simd, linear (l), simdlen (8), inbranch)]] (int l) |
| 81 |
{ // { dg-warning "GCC does not currently support simdlen 8 for type 'int'" "" { target aarch64*-*-* } .-2 } |
| 82 |
return l + 5; |
| 83 |
} |
| 84 |
|
| 85 |
// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 86 |
// { dg-final { scan-assembler-times "_ZGVbN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 87 |
// { dg-final { scan-assembler-times "_ZGVbM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 88 |
// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 89 |
// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 90 |
// { dg-final { scan-assembler-times "_ZGVcN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 91 |
// { dg-final { scan-assembler-times "_ZGVcM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 92 |
// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 93 |
// { dg-final { scan-assembler-times "_ZGVdM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 94 |
// { dg-final { scan-assembler-times "_ZGVdN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 95 |
// { dg-final { scan-assembler-times "_ZGVdM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 96 |
// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 97 |
// { dg-final { scan-assembler-times "_ZGVeM4u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 98 |
// { dg-final { scan-assembler-times "_ZGVeN4l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 99 |
// { dg-final { scan-assembler-times "_ZGVeM8l__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 100 |
// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f6i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 101 |
// { dg-final { scan-assembler-not "_ZGV\[bcde]M4l__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } } |
| 102 |
// { dg-final { scan-assembler-not "_ZGV\[bcde]N4u__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } } |
| 103 |
// { dg-final { scan-assembler-not "_ZGV\[bcde]M8u__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } } |
| 104 |
// { dg-final { scan-assembler-not "_ZGV\[bcde]N8l__Z2f6i:" { target { i?86-*-* x86_64-*-* } } } } |
| 105 |
|
| 106 |
int |
| 107 |
f7 (int l) |
| 108 |
{ |
| 109 |
return l + 6; |
| 110 |
} |
| 111 |
|
| 112 |
// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f7i:" { target { i?86-*-* x86_64-*-* } } } } |
| 113 |
|
| 114 |
int |
| 115 |
f8 (int l) |
| 116 |
{ |
| 117 |
return l + 7; |
| 118 |
} |
| 119 |
|
| 120 |
// { dg-final { scan-assembler-not "_ZGV\[a-zA-Z0-9]__Z2f8i:" { target { i?86-*-* x86_64-*-* } } } } |
| 121 |
|
| 122 |
[[omp::decl (declare variant (f7), match (construct={parallel})), |
| 123 |
omp::decl (declare simd uniform (l), simdlen(4))]] |
| 124 |
int |
| 125 |
f9 [[omp::decl (declare simd uniform (l) simdlen (8)), |
| 126 |
omp::decl (declare variant (f8) match (construct={parallel,for}))]] (int l) |
| 127 |
{ // { dg-warning "GCC does not currently support simdlen 8 for type 'int'" "" { target aarch64*-*-* } .-2 } |
| 128 |
return l + 8; |
| 129 |
} |
| 130 |
|
| 131 |
// { dg-final { scan-assembler-times "_ZGVbM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 132 |
// { dg-final { scan-assembler-times "_ZGVbN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 133 |
// { dg-final { scan-assembler-times "_ZGVcM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 134 |
// { dg-final { scan-assembler-times "_ZGVcN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 135 |
// { dg-final { scan-assembler-times "_ZGVdM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 136 |
// { dg-final { scan-assembler-times "_ZGVdN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 137 |
// { dg-final { scan-assembler-times "_ZGVeM4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 138 |
// { dg-final { scan-assembler-times "_ZGVeN4u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 139 |
// { dg-final { scan-assembler-times "_ZGVbM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 140 |
// { dg-final { scan-assembler-times "_ZGVbN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 141 |
// { dg-final { scan-assembler-times "_ZGVcM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 142 |
// { dg-final { scan-assembler-times "_ZGVcN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 143 |
// { dg-final { scan-assembler-times "_ZGVdM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 144 |
// { dg-final { scan-assembler-times "_ZGVdN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 145 |
// { dg-final { scan-assembler-times "_ZGVeM8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 146 |
// { dg-final { scan-assembler-times "_ZGVeN8u__Z2f9i:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 147 |
|
| 148 |
int z; |
| 149 |
|
| 150 |
void |
| 151 |
test () |
| 152 |
{ |
| 153 |
[[omp::directive (parallel)]] |
| 154 |
if (f9 (3) != 9) |
| 155 |
abort (); |
| 156 |
[[omp::directive (parallel for)]] |
| 157 |
for (int i = 0; i < 1; i++) |
| 158 |
if (f9 (4) != 11) |
| 159 |
abort (); |
| 160 |
if (f9 (5) != 13) |
| 161 |
abort (); |
| 162 |
} |
| 163 |
|
| 164 |
// { dg-final { scan-tree-dump-times " = f7 \\\(3\\\);" 1 "gimple" } } |
| 165 |
// { dg-final { scan-tree-dump-times " = f8 \\\(4\\\);" 1 "gimple" } } |
| 166 |
// { dg-final { scan-tree-dump-times " = f9 \\\(5\\\);" 1 "gimple" } } |
| 167 |
|
| 168 |
template <int N> |
| 169 |
int |
| 170 |
f10 (int x) |
| 171 |
{ |
| 172 |
return x + N; |
| 173 |
} |
| 174 |
|
| 175 |
template [[omp::decl (declare simd, notinbranch)]] int f10<0> (int); |
| 176 |
|
| 177 |
// { dg-final { scan-assembler-times "_ZGVbN4v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 178 |
// { dg-final { scan-assembler-times "_ZGVcN4v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 179 |
// { dg-final { scan-assembler-times "_ZGVdN8v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 180 |
// { dg-final { scan-assembler-times "_ZGVeN16v__Z3f10ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 181 |
|
| 182 |
template int f10<1> [[omp::decl (declare simd inbranch linear(x))]] (int x); |
| 183 |
|
| 184 |
// { dg-final { scan-assembler-times "_ZGVbM4l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 185 |
// { dg-final { scan-assembler-times "_ZGVcM4l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 186 |
// { dg-final { scan-assembler-times "_ZGVdM8l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 187 |
// { dg-final { scan-assembler-times "_ZGVeM16l__Z3f10ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 188 |
|
| 189 |
template <int N> |
| 190 |
int f11 (int); |
| 191 |
|
| 192 |
template <> [[omp::decl (declare simd, inbranch)]] int |
| 193 |
f11<0> (int x) |
| 194 |
{ |
| 195 |
return x; |
| 196 |
} |
| 197 |
|
| 198 |
// { dg-final { scan-assembler-times "_ZGVbM4v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 199 |
// { dg-final { scan-assembler-times "_ZGVcM4v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 200 |
// { dg-final { scan-assembler-times "_ZGVdM8v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 201 |
// { dg-final { scan-assembler-times "_ZGVeM16v__Z3f11ILi0EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 202 |
|
| 203 |
template <> int |
| 204 |
f11<1> [[omp::decl (declare simd, notinbranch, linear (y))]] (int y) |
| 205 |
{ |
| 206 |
return y; |
| 207 |
} |
| 208 |
|
| 209 |
// { dg-final { scan-assembler-times "_ZGVbN4l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 210 |
// { dg-final { scan-assembler-times "_ZGVcN4l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 211 |
// { dg-final { scan-assembler-times "_ZGVdN8l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 212 |
// { dg-final { scan-assembler-times "_ZGVeN16l__Z3f11ILi1EEii:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 213 |
|
| 214 |
struct S |
| 215 |
{ |
| 216 |
[[omp::decl (declare simd, inbranch, uniform (this))]] int f12 (int x); |
| 217 |
int f13 [[gnu::noinline, omp::decl (declare simd notinbranch uniform (this) linear (y))]] (int y) { return y; } |
| 218 |
}; |
| 219 |
|
| 220 |
int |
| 221 |
S::f12 (int x) |
| 222 |
{ |
| 223 |
return x; |
| 224 |
} |
| 225 |
|
| 226 |
// { dg-final { scan-assembler-times "_ZGVbM4uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 227 |
// { dg-final { scan-assembler-times "_ZGVcM4uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 228 |
// { dg-final { scan-assembler-times "_ZGVdM8uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 229 |
// { dg-final { scan-assembler-times "_ZGVeM16uv__ZN1S3f12Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 230 |
|
| 231 |
// { dg-final { scan-assembler-times "_ZGVbN4ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 232 |
// { dg-final { scan-assembler-times "_ZGVcN4ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 233 |
// { dg-final { scan-assembler-times "_ZGVdN8ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 234 |
// { dg-final { scan-assembler-times "_ZGVeN16ul__ZN1S3f13Ei:" 1 { target { i?86-*-* x86_64-*-* } } } } |
| 235 |
|
| 236 |
int |
| 237 |
f14 (S &p, int x) |
| 238 |
{ |
| 239 |
return p.f13 (x); |
| 240 |
} |