Skip to content

Commit daf9d7f

Browse files
author
Chen Zheng
committed
[PowerPC] add testcaseis for PPC, NFC
For builtin __builtin_cpu_is and __builtin_cpu_supports
1 parent 12dba4d commit daf9d7f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/test/Sema/builtin-cpu-supports.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clang_cc1 -fsyntax-only -triple aarch64-linux-gnu -verify %s
33
// RUN: %clang_cc1 -fsyntax-only -triple riscv32-linux-gnu -verify %s
44
// 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
58

69
extern void a(const char *);
710

@@ -45,5 +48,16 @@ int main(void) {
4548
a("vsx");
4649
#endif
4750

51+
#ifdef __powerpc__
52+
if (__builtin_cpu_is("garbage")) // expected-error {{invalid cpu name for builtin}}
53+
a("vsx");
54+
55+
if (__builtin_cpu_is("power3")) // expected-error {{invalid cpu name for builtin}}
56+
a("vsx");
57+
58+
if (__builtin_cpu_supports("garbage")) // expected-warning {{invalid cpu feature string for builtin}}
59+
a("vsx");
60+
#endif
61+
4862
return 0;
4963
}

0 commit comments

Comments
 (0)