1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-linux-gnu -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -triple aarch64-linux-gnu -verify %s
3 // RUN: %clang_cc1 -fsyntax-only -triple riscv32-linux-gnu -verify %s
4 // RUN: %clang_cc1 -fsyntax-only -triple riscv64-linux-gnu -verify %s
5 // RUN: %clang_cc1 -fsyntax-only -triple powerpc64le-unknown-linux -verify %s
6 // RUN: %clang_cc1 -fsyntax-only -triple powerpc64-unknown-aix7.2.0.0 -verify %s
7 // RUN: %clang_cc1 -fsyntax-only -triple powerpc-unknown-aix7.2.0.0 -verify %s
9 extern void a(const char *);
11 extern const char *str
;
15 if (__builtin_cpu_supports("ss")) // expected-warning {{invalid cpu feature string}}
18 if (__builtin_cpu_supports(str
)) // expected-error {{expression is not a string literal}}
21 if (__builtin_cpu_is("int")) // expected-error {{invalid cpu name for builtin}}
24 (void)__builtin_cpu_is("x86-64"); // expected-error {{invalid cpu name for builtin}}
25 (void)__builtin_cpu_is("x86-64-v2"); // expected-error {{invalid cpu name for builtin}}
26 (void)__builtin_cpu_is("x86-64-v3"); // expected-error {{invalid cpu name for builtin}}
27 (void)__builtin_cpu_is("x86-64-v4"); // expected-error {{invalid cpu name for builtin}}
29 (void)__builtin_cpu_supports("x86-64");
30 (void)__builtin_cpu_supports("x86-64-v2");
31 (void)__builtin_cpu_supports("x86-64-v3");
32 (void)__builtin_cpu_supports("x86-64-v4");
33 (void)__builtin_cpu_supports("x86-64-v5"); // expected-warning {{invalid cpu feature string for builtin}}
37 if (__builtin_cpu_supports("neon")) // expected-warning {{invalid cpu feature string for builtin}}
40 if (__builtin_cpu_is("cortex-x3")) // expected-error {{builtin is not supported on this target}}
43 __builtin_cpu_init(); // expected-error {{builtin is not supported on this target}}
47 if (__builtin_cpu_supports("garbage")) // expected-warning {{invalid cpu feature string for builtin}}
52 if (__builtin_cpu_is("garbage")) // expected-error {{invalid cpu name for builtin}}
55 if (__builtin_cpu_is("power3")) // expected-error {{invalid cpu name for builtin}}
58 if (__builtin_cpu_supports("garbage")) // expected-warning {{invalid cpu feature string for builtin}}