diff options
author | dim <dim@FreeBSD.org> | 2015-07-05 14:23:59 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-07-05 14:23:59 +0000 |
commit | e7bcad327814a78ecb8d5f5545d2e3df84c67a5c (patch) | |
tree | ac719b5984165053bf83d71142e4d96b609b9784 /test/Sema/builtin-cpu-supports.c | |
parent | 9dd834653b811ad20382e98a87dff824980c9916 (diff) | |
download | FreeBSD-src-e7bcad327814a78ecb8d5f5545d2e3df84c67a5c.zip FreeBSD-src-e7bcad327814a78ecb8d5f5545d2e3df84c67a5c.tar.gz |
Vendor import of clang trunk r241361:
https://llvm.org/svn/llvm-project/cfe/trunk@241361
Diffstat (limited to 'test/Sema/builtin-cpu-supports.c')
-rw-r--r-- | test/Sema/builtin-cpu-supports.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Sema/builtin-cpu-supports.c b/test/Sema/builtin-cpu-supports.c new file mode 100644 index 0000000..c537b41 --- /dev/null +++ b/test/Sema/builtin-cpu-supports.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-linux-gnu -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple powerpc64le-linux-gnu -verify %s + +extern void a(const char *); + +extern const char *str; + +int main() { +#ifdef __x86_64__ + if (__builtin_cpu_supports("ss")) // expected-error {{invalid cpu feature string}} + a("sse4.2"); + + if (__builtin_cpu_supports(str)) // expected-error {{expression is not a string literal}} + a(str); +#else + if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}} + a("vsx"); +#endif + + return 0; +} |