55// RUN: %clang_cc1 -triple riscv64 -verify=expected,riscv64 -fsyntax-only %s
66// RUN: %clang_cc1 -triple x86_64 -verify=expected,x86_64 -fsyntax-only %s
77
8- #if defined(__loongarch__) && !__has_attribute(model)
8+ #if ( defined(__loongarch__) || defined(__x86_64__) ) && !__has_attribute(model)
99#error "Should support model attribute"
1010#endif
1111
@@ -14,51 +14,49 @@ int a __attribute((model("tiny"))); // aarch64-warning {{unknown attribute 'm
1414 // mips64-warning {{unknown attribute 'model' ignored}} \
1515 // powerpc64-warning {{unknown attribute 'model' ignored}} \
1616 // riscv64-warning {{unknown attribute 'model' ignored}} \
17- // x86_64-warning {{unknown attribute 'model' ignored }}
17+ // x86_64-error {{code model 'tiny' is not supported on this target }}
1818int b __attribute ((model(" small" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
1919 // loongarch64-error {{code model 'small' is not supported on this target}} \
2020 // mips64-warning {{unknown attribute 'model' ignored}} \
2121 // powerpc64-warning {{unknown attribute 'model' ignored}} \
22- // riscv64-warning {{unknown attribute 'model' ignored}} \
23- // x86_64-warning {{unknown attribute 'model' ignored}}
22+ // riscv64-warning {{unknown attribute 'model' ignored}}
2423int c __attribute ((model(" normal" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
2524 // mips64-warning {{unknown attribute 'model' ignored}} \
2625 // powerpc64-warning {{unknown attribute 'model' ignored}} \
2726 // riscv64-warning {{unknown attribute 'model' ignored}} \
28- // x86_64-warning {{unknown attribute 'model' ignored }}
27+ // x86_64-error {{code model 'normal' is not supported on this target }}
2928int d __attribute ((model(" kernel" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
3029 // loongarch64-error {{code model 'kernel' is not supported on this target}} \
3130 // mips64-warning {{unknown attribute 'model' ignored}} \
3231 // powerpc64-warning {{unknown attribute 'model' ignored}} \
3332 // riscv64-warning {{unknown attribute 'model' ignored}} \
34- // x86_64-warning {{unknown attribute 'model' ignored }}
33+ // x86_64-error {{code model 'kernel' is not supported on this target }}
3534int e __attribute ((model(" medium" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
3635 // mips64-warning {{unknown attribute 'model' ignored}} \
3736 // powerpc64-warning {{unknown attribute 'model' ignored}} \
3837 // riscv64-warning {{unknown attribute 'model' ignored}} \
39- // x86_64-warning {{unknown attribute 'model' ignored }}
38+ // x86_64-error {{code model 'medium' is not supported on this target }}
4039int f __attribute ((model(" large" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
4140 // loongarch64-error {{code model 'large' is not supported on this target}} \
4241 // mips64-warning {{unknown attribute 'model' ignored}} \
4342 // powerpc64-warning {{unknown attribute 'model' ignored}} \
44- // riscv64-warning {{unknown attribute 'model' ignored}} \
45- // x86_64-warning {{unknown attribute 'model' ignored}}
43+ // riscv64-warning {{unknown attribute 'model' ignored}}
4644int g __attribute ((model(" extreme" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
4745 // mips64-warning {{unknown attribute 'model' ignored}} \
4846 // powerpc64-warning {{unknown attribute 'model' ignored}} \
4947 // riscv64-warning {{unknown attribute 'model' ignored}} \
50- // x86_64-warning {{unknown attribute 'model' ignored }}
48+ // x86_64-error {{code model 'extreme' is not supported on this target }}
5149
5250void __attribute ((model(" extreme" ))) h() {} // aarch64-warning {{unknown attribute 'model' ignored}} \
5351 // loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
5452 // mips64-warning {{unknown attribute 'model' ignored}} \
5553 // powerpc64-warning {{unknown attribute 'model' ignored}} \
5654 // 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 }}
5856
5957thread_local int i __attribute ((model(" extreme" ))); // aarch64-warning {{unknown attribute 'model' ignored}} \
6058 // loongarch64-error {{'model' attribute only applies to non-TLS global variables}} \
6159 // mips64-warning {{unknown attribute 'model' ignored}} \
6260 // powerpc64-warning {{unknown attribute 'model' ignored}} \
6361 // riscv64-warning {{unknown attribute 'model' ignored}} \
64- // x86_64-warning {{unknown attribute 'model' ignored }}
62+ // x86_64-error {{'model' attribute only applies to non-TLS global variables }}
0 commit comments