diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/Preprocessor/is_target_arm.c | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Diffstat (limited to 'test/Preprocessor/is_target_arm.c')
-rw-r--r-- | test/Preprocessor/is_target_arm.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/Preprocessor/is_target_arm.c b/test/Preprocessor/is_target_arm.c new file mode 100644 index 0000000000000..9e1afe6ec6c15 --- /dev/null +++ b/test/Preprocessor/is_target_arm.c @@ -0,0 +1,51 @@ +// RUN: %clang_cc1 -fsyntax-only -triple thumbv7--windows-msvc19.11.0 -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple armv7--windows-msvc19.11.0 -DARM -verify %s +// expected-no-diagnostics + +// ARM does match arm and thumb. +#if !__is_target_arch(arm) + #error "mismatching arch" +#endif + +#if __is_target_arch(armeb) || __is_target_arch(armebv7) || __is_target_arch(thumbeb) || __is_target_arch(thumbebv7) + #error "mismatching arch" +#endif + +// ARMV7 does match armv7 and thumbv7. +#if !__is_target_arch(armv7) + #error "mismatching arch" +#endif + +// ARMV6 does not match armv7 or thumbv7. +#if __is_target_arch(armv6) + #error "mismatching arch" +#endif + +#if __is_target_arch(arm64) + #error "mismatching arch" +#endif + +#ifndef ARM + +// Allow checking for precise arch + subarch. +#if !__is_target_arch(thumbv7) + #error "mismatching arch" +#endif + +// But also allow checking for the arch without subarch. +#if !__is_target_arch(thumb) + #error "mismatching arch" +#endif + +// Same arch with a different subarch doesn't match. +#if __is_target_arch(thumbv6) + #error "mismatching arch" +#endif + +#else + +#if __is_target_arch(thumbv7) || __is_target_arch(thumb) + #error "mismatching arch" +#endif + +#endif |