xref: /aosp_15_r20/external/clang/test/Sema/builtin-cpu-supports.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
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
3 
4 extern void a(const char *);
5 
6 extern const char *str;
7 
main()8 int main() {
9 #ifdef __x86_64__
10   if (__builtin_cpu_supports("ss")) // expected-error {{invalid cpu feature string}}
11     a("sse4.2");
12 
13   if (__builtin_cpu_supports(str)) // expected-error {{expression is not a string literal}}
14     a(str);
15 #else
16   if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}}
17     a("vsx");
18 #endif
19 
20   return 0;
21 }
22