blob: 026b5b7e38e9ae6fe1b34d9b69506e59dc9cbdb9 [file] [log] [blame]
Eric Christopherd9832702015-06-29 21:00:05 +00001// 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
4extern void a(const char *);
5
6extern const char *str;
7
8int 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);
Craig Topper699ae0c2017-08-10 20:28:30 +000015
16 if (__builtin_cpu_is("int")) // expected-error {{invalid cpu name for builtin}}
17 a("intel");
Eric Christopherd9832702015-06-29 21:00:05 +000018#else
19 if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}}
20 a("vsx");
Craig Topper699ae0c2017-08-10 20:28:30 +000021
22 if (__builtin_cpu_is("pwr9")) // expected-error {{use of unknown builtin}}
23 a("pwr9");
Eric Christopherd9832702015-06-29 21:00:05 +000024#endif
25
26 return 0;
27}