|
1 |
| -// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s |
2 |
| -// RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64 -fsyntax-only %s |
3 |
| -// RUN: %clang_cc1 -triple mips64 -verify=expected,mips64 -fsyntax-only %s |
4 |
| -// RUN: %clang_cc1 -triple powerpc64 -verify=expected,powerpc64 -fsyntax-only %s |
5 |
| -// RUN: %clang_cc1 -triple riscv64 -verify=expected,riscv64 -fsyntax-only %s |
6 |
| -// RUN: %clang_cc1 -triple x86_64 -verify=expected,x86_64 -fsyntax-only %s |
| 1 | +// RUN: %clang_cc1 -triple aarch64 -verify=unsupported -fsyntax-only %s |
| 2 | +// RUN: %clang_cc1 -triple loongarch64 -verify=loongarch64 -fsyntax-only %s |
| 3 | +// RUN: %clang_cc1 -triple mips64 -verify=unsupported -fsyntax-only %s |
| 4 | +// RUN: %clang_cc1 -triple powerpc64 -verify=unsupported -fsyntax-only %s |
| 5 | +// RUN: %clang_cc1 -triple riscv64 -verify=unsupported -fsyntax-only %s |
| 6 | +// RUN: %clang_cc1 -triple x86_64 -verify=x86_64 -fsyntax-only %s |
| 7 | +// RUN: %clang_cc1 -triple nvptx64-unknown-cuda -fcuda-is-device -x cuda -verify=ignored -fsyntax-only %s |
| 8 | +// RUN: %clang_cc1 -triple amdgcn -verify=ignored -fsyntax-only %s |
| 9 | +// RUN: %clang_cc1 -triple r600 -verify=ignored -fsyntax-only %s |
| 10 | +// RUN: %clang_cc1 -triple spirv-linux-vulkan-library -verify=ignored -fsyntax-only %s |
| 11 | +// RUN: %clang_cc1 -triple spirv32-unknown-unknown -verify=ignored -fsyntax-only %s |
| 12 | +// RUN: %clang_cc1 -triple spirv64-unknown-unknown -verify=ignored -fsyntax-only %s |
7 | 13 |
|
8 |
| -#if defined(__loongarch__) && !__has_attribute(model) |
| 14 | +// RUN: %clang_cc1 -triple x86_64 -aux-triple nvptx64 -x cuda -verify=x86_64 -fsyntax-only %s |
| 15 | +// RUN: %clang_cc1 -triple nvptx64 -aux-triple x86_64 -x cuda -fcuda-is-device -verify=nvptx64-x86_64 -fsyntax-only %s |
| 16 | +// RUN: %clang_cc1 -triple aarch64 -aux-triple nvptx64 -x cuda -verify=unsupported -fsyntax-only %s |
| 17 | +// RUN: %clang_cc1 -triple nvptx64 -aux-triple aarch64 -x cuda -fcuda-is-device -verify=nvptx64-unsupported -fsyntax-only %s |
| 18 | + |
| 19 | +#if (defined(__loongarch__) || defined(__x86_64__)) && !__has_attribute(model) |
9 | 20 | #error "Should support model attribute"
|
10 | 21 | #endif
|
11 | 22 |
|
12 |
| -int a __attribute((model("tiny"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
| 23 | +int a __attribute((model("tiny"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
13 | 24 | // loongarch64-error {{code model 'tiny' is not supported on this target}} \
|
14 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
15 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
16 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
17 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
18 |
| -int b __attribute((model("small"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
| 25 | + // x86_64-error {{code model 'tiny' is not supported on this target}} \ |
| 26 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 27 | + // nvptx64-x86_64-error {{code model 'tiny' is not supported on this target}} |
| 28 | +int b __attribute((model("small"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
19 | 29 | // loongarch64-error {{code model 'small' is not supported on this target}} \
|
20 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
21 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
22 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
23 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
24 |
| -int c __attribute((model("normal"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
25 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
26 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
27 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
28 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
29 |
| -int d __attribute((model("kernel"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
| 30 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} |
| 31 | +int c __attribute((model("normal"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 32 | + // x86_64-error {{code model 'normal' is not supported on this target}} \ |
| 33 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 34 | + // nvptx64-x86_64-error {{code model 'normal' is not supported on this target}} |
| 35 | +int d __attribute((model("kernel"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
30 | 36 | // loongarch64-error {{code model 'kernel' is not supported on this target}} \
|
31 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
32 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
33 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
34 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
35 |
| -int e __attribute((model("medium"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
36 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
37 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
38 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
39 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
40 |
| -int f __attribute((model("large"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
| 37 | + // x86_64-error {{code model 'kernel' is not supported on this target}} \ |
| 38 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 39 | + // nvptx64-x86_64-error {{code model 'kernel' is not supported on this target}} |
| 40 | +int e __attribute((model("medium"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 41 | + // x86_64-error {{code model 'medium' is not supported on this target}} \ |
| 42 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 43 | + // nvptx64-x86_64-error {{code model 'medium' is not supported on this target}} |
| 44 | +int f __attribute((model("large"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
41 | 45 | // loongarch64-error {{code model 'large' is not supported on this target}} \
|
42 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
43 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
44 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
45 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
46 |
| -int g __attribute((model("extreme"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
47 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
48 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
49 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
50 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
| 46 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} |
| 47 | +int g __attribute((model("extreme"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 48 | + // x86_64-error {{code model 'extreme' is not supported on this target}} \ |
| 49 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 50 | + // nvptx64-x86_64-error {{code model 'extreme' is not supported on this target}} |
51 | 51 |
|
52 |
| -void __attribute((model("extreme"))) h() {} // aarch64-warning {{unknown attribute 'model' ignored}} \ |
| 52 | +void __attribute((model("extreme"))) h() {} // unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 53 | + // ignored-error {{'model' attribute only applies to non-TLS global variables}} \ |
53 | 54 | // loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
|
54 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
55 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
56 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
57 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
| 55 | + // x86_64-error {{'model' attribute only applies to non-TLS global variables}} \ |
| 56 | + // nvptx64-unsupported-error {{'model' attribute only applies to non-TLS global variables}} \ |
| 57 | + // nvptx64-x86_64-error {{'model' attribute only applies to non-TLS global variables}} |
58 | 58 |
|
59 |
| -thread_local int i __attribute((model("extreme"))); // aarch64-warning {{unknown attribute 'model' ignored}} \ |
60 |
| - // loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \ |
61 |
| - // mips64-warning {{unknown attribute 'model' ignored}} \ |
62 |
| - // powerpc64-warning {{unknown attribute 'model' ignored}} \ |
63 |
| - // riscv64-warning {{unknown attribute 'model' ignored}} \ |
64 |
| - // x86_64-warning {{unknown attribute 'model' ignored}} |
| 59 | +#if !defined(__CUDA__) || !defined(__CUDA_ARCH__) |
| 60 | +// if we are compiling for non-cuda host, or host mode in a CUDA compile |
| 61 | +#if !defined(__AMDGCN__) && !defined(__R600__) && !defined(__SPIRV__) |
| 62 | +// for all non-cuda hosts, above targets don't support thread_local |
| 63 | +thread_local |
| 64 | +#endif |
| 65 | +#endif |
| 66 | +int i __attribute((model("extreme"))); // unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 67 | + // loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \ |
| 68 | + // x86_64-error {{'model' attribute only applies to non-TLS global variables}} \ |
| 69 | + // nvptx64-unsupported-warning {{unknown attribute 'model' ignored}} \ |
| 70 | + // nvptx64-x86_64-error {{code model 'extreme' is not supported on this target}} |
0 commit comments