Skip to content

Commit 2fdf2ee

Browse files
committed
add nvptx RUN line to test, refactor test
1 parent 8aa6b3f commit 2fdf2ee

File tree

1 file changed

+22
-44
lines changed

1 file changed

+22
-44
lines changed

clang/test/Sema/attr-model.cpp

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,40 @@
1-
// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s
1+
// RUN: %clang_cc1 -triple aarch64 -verify=expected,unsupported -fsyntax-only %s
22
// 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
3+
// RUN: %clang_cc1 -triple mips64 -verify=expected,unsupported -fsyntax-only %s
4+
// RUN: %clang_cc1 -triple powerpc64 -verify=expected,unsupported -fsyntax-only %s
5+
// RUN: %clang_cc1 -triple riscv64 -verify=expected,unsupported -fsyntax-only %s
66
// RUN: %clang_cc1 -triple x86_64 -verify=expected,x86_64 -fsyntax-only %s
7+
// RUN: %clang_cc1 -triple nvptx64 -fcuda-is-device -verify=expected,unsupported -fsyntax-only %s
78

89
#if (defined(__loongarch__) || defined(__x86_64__)) && !__has_attribute(model)
910
#error "Should support model attribute"
1011
#endif
1112

12-
int a __attribute((model("tiny"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
13+
int a __attribute((model("tiny"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
1314
// 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}} \
1715
// x86_64-error {{code model 'tiny' is not supported on this target}}
18-
int b __attribute((model("small"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
19-
// 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-
int c __attribute((model("normal"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
24-
// mips64-warning {{unknown attribute 'model' ignored}} \
25-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
26-
// riscv64-warning {{unknown attribute 'model' ignored}} \
16+
int b __attribute((model("small"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
17+
// loongarch64-error {{code model 'small' is not supported on this target}}
18+
int c __attribute((model("normal"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
2719
// x86_64-error {{code model 'normal' is not supported on this target}}
28-
int d __attribute((model("kernel"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
20+
int d __attribute((model("kernel"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
2921
// loongarch64-error {{code model 'kernel' is not supported on this target}} \
30-
// mips64-warning {{unknown attribute 'model' ignored}} \
31-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
32-
// riscv64-warning {{unknown attribute 'model' ignored}} \
3322
// x86_64-error {{code model 'kernel' is not supported on this target}}
34-
int e __attribute((model("medium"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
35-
// mips64-warning {{unknown attribute 'model' ignored}} \
36-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
37-
// riscv64-warning {{unknown attribute 'model' ignored}} \
23+
int e __attribute((model("medium"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
3824
// x86_64-error {{code model 'medium' is not supported on this target}}
39-
int f __attribute((model("large"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
40-
// loongarch64-error {{code model 'large' is not supported on this target}} \
41-
// mips64-warning {{unknown attribute 'model' ignored}} \
42-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
43-
// riscv64-warning {{unknown attribute 'model' ignored}}
44-
int g __attribute((model("extreme"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
45-
// mips64-warning {{unknown attribute 'model' ignored}} \
46-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
47-
// riscv64-warning {{unknown attribute 'model' ignored}} \
25+
int f __attribute((model("large"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
26+
// loongarch64-error {{code model 'large' is not supported on this target}}
27+
int g __attribute((model("extreme"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
4828
// x86_64-error {{code model 'extreme' is not supported on this target}}
4929

50-
void __attribute((model("extreme"))) h() {} // aarch64-warning {{unknown attribute 'model' ignored}} \
30+
void __attribute((model("extreme"))) h() {} // unsupported-warning {{unknown attribute 'model' ignored}} \
5131
// loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
52-
// mips64-warning {{unknown attribute 'model' ignored}} \
53-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
54-
// riscv64-warning {{unknown attribute 'model' ignored}} \
5532
// x86_64-error {{'model' attribute only applies to non-TLS global variables}}
5633

57-
thread_local int i __attribute((model("extreme"))); // aarch64-warning {{unknown attribute 'model' ignored}} \
58-
// loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
59-
// mips64-warning {{unknown attribute 'model' ignored}} \
60-
// powerpc64-warning {{unknown attribute 'model' ignored}} \
61-
// riscv64-warning {{unknown attribute 'model' ignored}} \
62-
// x86_64-error {{'model' attribute only applies to non-TLS global variables}}
34+
// NVPTX doesn't support thread_local at all.
35+
#ifndef __NVPTX__
36+
thread_local
37+
#endif
38+
int i __attribute((model("extreme"))); // unsupported-warning {{unknown attribute 'model' ignored}} \
39+
// loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
40+
// x86_64-error {{'model' attribute only applies to non-TLS global variables}}

0 commit comments

Comments
 (0)