[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Sema / builtin-cpu-supports.c
blobad310128fecebf6d6b5f78046692330ad2eb9612
1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-linux-gnu -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -triple powerpc64le-linux-gnu -verify %s
4 extern void a(const char *);
6 extern const char *str;
8 int main(void) {
9 #ifdef __x86_64__
10 if (__builtin_cpu_supports("ss")) // expected-error {{invalid cpu feature string}}
11 a("sse4.2");
13 if (__builtin_cpu_supports(str)) // expected-error {{expression is not a string literal}}
14 a(str);
16 if (__builtin_cpu_is("int")) // expected-error {{invalid cpu name for builtin}}
17 a("intel");
19 (void)__builtin_cpu_is("x86-64"); // expected-error {{invalid cpu name for builtin}}
20 (void)__builtin_cpu_is("x86-64-v2"); // expected-error {{invalid cpu name for builtin}}
21 (void)__builtin_cpu_is("x86-64-v3"); // expected-error {{invalid cpu name for builtin}}
22 (void)__builtin_cpu_is("x86-64-v4"); // expected-error {{invalid cpu name for builtin}}
24 (void)__builtin_cpu_supports("x86-64");
25 (void)__builtin_cpu_supports("x86-64-v2");
26 (void)__builtin_cpu_supports("x86-64-v3");
27 (void)__builtin_cpu_supports("x86-64-v4");
28 (void)__builtin_cpu_supports("x86-64-v5"); // expected-error {{invalid cpu feature string for builtin}}
29 #else
30 if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}}
31 a("vsx");
33 if (__builtin_cpu_is("pwr9")) // expected-error {{use of unknown builtin}}
34 a("pwr9");
35 #endif
37 return 0;