Skip to content

Commit

Permalink
[PowerPC] add testcaseis for PPC, NFC
Browse files Browse the repository at this point in the history
For builtin __builtin_cpu_is and __builtin_cpu_supports
  • Loading branch information
chenzheng1030 committed Jul 25, 2024
1 parent 12dba4d commit daf9d7f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions clang/test/Sema/builtin-cpu-supports.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// RUN: %clang_cc1 -fsyntax-only -triple aarch64-linux-gnu -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple riscv32-linux-gnu -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple riscv64-linux-gnu -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple powerpc64le-unknown-linux -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple powerpc64-unknown-aix7.2.0.0 -verify %s
// RUN: %clang_cc1 -fsyntax-only -triple powerpc-unknown-aix7.2.0.0 -verify %s

extern void a(const char *);

Expand Down Expand Up @@ -45,5 +48,16 @@ int main(void) {
a("vsx");
#endif

#ifdef __powerpc__
if (__builtin_cpu_is("garbage")) // expected-error {{invalid cpu name for builtin}}
a("vsx");

if (__builtin_cpu_is("power3")) // expected-error {{invalid cpu name for builtin}}
a("vsx");

if (__builtin_cpu_supports("garbage")) // expected-warning {{invalid cpu feature string for builtin}}
a("vsx");
#endif

return 0;
}

0 comments on commit daf9d7f

Please sign in to comment.