Eric Christopher | d983270 | 2015-06-29 21:00:05 +0000 | [diff] [blame] | 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 | |
| 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); |
Craig Topper | 699ae0c | 2017-08-10 20:28:30 +0000 | [diff] [blame] | 15 | |
| 16 | if (__builtin_cpu_is("int")) // expected-error {{invalid cpu name for builtin}} |
| 17 | a("intel"); |
Eric Christopher | d983270 | 2015-06-29 21:00:05 +0000 | [diff] [blame] | 18 | #else |
| 19 | if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}} |
| 20 | a("vsx"); |
Craig Topper | 699ae0c | 2017-08-10 20:28:30 +0000 | [diff] [blame] | 21 | |
| 22 | if (__builtin_cpu_is("pwr9")) // expected-error {{use of unknown builtin}} |
| 23 | a("pwr9"); |
Eric Christopher | d983270 | 2015-06-29 21:00:05 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
| 26 | return 0; |
| 27 | } |