diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/armv7k-abi.c | 88 | ||||
| -rw-r--r-- | clang/test/CodeGen/complex-math.c | 4 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/armv7k.cpp | 68 | ||||
| -rw-r--r-- | clang/test/Driver/appletvos-version-min.c | 7 | ||||
| -rw-r--r-- | clang/test/Driver/watchos-version-min.c | 7 | ||||
| -rw-r--r-- | clang/test/Preprocessor/init-v7k-compat.c | 184 | ||||
| -rw-r--r-- | clang/test/SemaObjC/bool-type.m | 12 |
7 files changed, 370 insertions, 0 deletions
diff --git a/clang/test/CodeGen/armv7k-abi.c b/clang/test/CodeGen/armv7k-abi.c new file mode 100644 index 00000000000..93c0f0ca259 --- /dev/null +++ b/clang/test/CodeGen/armv7k-abi.c @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -triple thumbv7k-apple-watchos2.0 -target-abi aapcs16 %s -o - -emit-llvm | FileCheck %s + +// Make sure 64 and 128 bit types are naturally aligned by the v7k ABI: + +// CHECK: target datalayout = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128" + +typedef struct { + float arr[4]; +} HFA; + +// CHECK: define void @simple_hfa([4 x float] %h.coerce) +void simple_hfa(HFA h) {} + +// CHECK: define %struct.HFA @return_simple_hfa +HFA return_simple_hfa() {} + +typedef struct { + double arr[4]; +} BigHFA; + +// We don't want any padding type to be included by Clang when using the +// APCS-VFP ABI, that needs to be handled by LLVM if needed. + +// CHECK: void @no_padding(i32 %r0, i32 %r1, i32 %r2, [4 x double] %d0_d3.coerce, [4 x double] %d4_d7.coerce, [4 x double] %sp.coerce, i64 %split) +void no_padding(int r0, int r1, int r2, BigHFA d0_d3, BigHFA d4_d7, BigHFA sp, + long long split) {} + +// Structs larger than 16 bytes should be passed indirectly in space allocated +// by the caller (a pointer to this storage should be what occurs in the arg +// list). + +typedef struct { + float x; + long long y; + double z; +} BigStruct; + +// CHECK: define void @big_struct_indirect(%struct.BigStruct* %b) +void big_struct_indirect(BigStruct b) {} + +// CHECK: define void @return_big_struct_indirect(%struct.BigStruct* noalias sret +BigStruct return_big_struct_indirect() {} + +// Structs smaller than 16 bytes should be passed directly, and coerced to +// either [N x i32] or [N x i64] depending on alignment requirements. + +typedef struct { + float x; + int y; + double z; +} SmallStruct; + +// CHECK: define void @small_struct_direct([2 x i64] %s.coerce) +void small_struct_direct(SmallStruct s) {} + +// CHECK: define [4 x i32] @return_small_struct_direct() +SmallStruct return_small_struct_direct() {} + +typedef struct { + float x; + int y; + int z; +} SmallStructSmallAlign; + +// CHECK: define void @small_struct_align_direct([3 x i32] %s.coerce) +void small_struct_align_direct(SmallStructSmallAlign s) {} + +typedef struct { + char x; + short y; +} PaddedSmallStruct; + +// CHECK: define i32 @return_padded_small_struct() +PaddedSmallStruct return_padded_small_struct() {} + +typedef struct { + char arr[7]; +} OddlySizedStruct; + +// CHECK: define [2 x i32] @return_oddly_sized_struct() +OddlySizedStruct return_oddly_sized_struct() {} + +// CHECK: define double @test_va_arg(i8* %l) +// CHECK: load double, double* +double test_va_arg(__builtin_va_list l) { + return __builtin_va_arg(l, double); +} + diff --git a/clang/test/CodeGen/complex-math.c b/clang/test/CodeGen/complex-math.c index 36ef271b0ae..96c7ad9cdbc 100644 --- a/clang/test/CodeGen/complex-math.c +++ b/clang/test/CodeGen/complex-math.c @@ -3,6 +3,7 @@ // RUN: %clang_cc1 %s -O1 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86 // RUN: %clang_cc1 %s -O1 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC // RUN: %clang_cc1 %s -O1 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARM +// RUN: %clang_cc1 %s -O1 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K float _Complex add_float_rr(float a, float b) { // X86-LABEL: @add_float_rr( @@ -477,5 +478,8 @@ _Bool ne_float_cc(float _Complex a, float _Complex b) { _Complex double foo(_Complex double a, _Complex double b) { // ARM-LABEL: @foo( // ARM: call arm_aapcscc { double, double } @__muldc3 + + // ARM7K-LABEL: @foo( + // ARM7K: call { double, double } @__muldc3 return a*b; } diff --git a/clang/test/CodeGenCXX/armv7k.cpp b/clang/test/CodeGenCXX/armv7k.cpp new file mode 100644 index 00000000000..9b27b651fe3 --- /dev/null +++ b/clang/test/CodeGenCXX/armv7k.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck %s +// RUN: %clang_cc1 %s -triple=thumbv7k-apple-watchos -emit-llvm -o - -target-abi aapcs16 | FileCheck -check-prefix=CHECK-GLOBALS %s + +// __cxa_guard_acquire argument is 64-bit +// rdar://11540122 +struct A { + A(); +}; + +void f() { + // CHECK: call i32 @__cxa_guard_acquire(i32* + static A a; +} + +// ARM64 uses the C++11 definition of POD. +// rdar://12650514 +namespace test1 { + // This class is POD in C++11 and cannot have objects allocated in + // its tail-padding. + struct ABase {}; + struct A : ABase { + int x; + char c; + }; + + struct B : A { + char d; + }; + + int test() { + return sizeof(B); + } + // CHECK: define i32 @_ZN5test14testEv() + // CHECK: ret i32 12 +} + +namespace std { + class type_info; +} + +// ARM64 uses string comparisons for what would otherwise be +// default-visibility weak RTTI. rdar://12650568 +namespace test2 { + struct A { + virtual void foo(); + }; + void A::foo() {} + // Tested below because these globals get kindof oddly rearranged. + + struct __attribute__((visibility("hidden"))) B {}; + const std::type_info &b0 = typeid(B); + // CHECK-GLOBALS: @_ZTSN5test21BE = linkonce_odr hidden constant + // CHECK-GLOBALS: @_ZTIN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21BE, i32 0, i32 0) } + + const std::type_info &b1 = typeid(B*); + // CHECK-GLOBALS: @_ZTSPN5test21BE = linkonce_odr hidden constant + // CHECK-GLOBALS: @_ZTIPN5test21BE = linkonce_odr hidden constant { {{.*}}, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_ZTSPN5test21BE, i32 0, i32 0), i32 0, i8* bitcast + + struct C {}; + const std::type_info &c0 = typeid(C); + // CHECK-GLOBALS: @_ZTSN5test21CE = linkonce_odr constant [11 x i8] c"N5test21CE\00" + // CHECK-GLOBALS: @_ZTIN5test21CE = linkonce_odr constant { {{.*}}, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @_ZTSN5test21CE, i32 0, i32 0) } +} + +// va_list should be based on "char *" rather than "void *". + +// CHECK: define void @_Z11whatsVaListPc +void whatsVaList(__builtin_va_list l) {} diff --git a/clang/test/Driver/appletvos-version-min.c b/clang/test/Driver/appletvos-version-min.c new file mode 100644 index 00000000000..9ff8297fe9e --- /dev/null +++ b/clang/test/Driver/appletvos-version-min.c @@ -0,0 +1,7 @@ +// REQUIRES: x86-registered-target +// REQUIRES: aarch64-registered-target +// RUN: %clang -target i386-apple-darwin10 -mappletvsimulator-version-min=9.0 -arch x86_64 -S -o - %s | FileCheck %s +// RUN: %clang -target armv7s-apple-darwin10 -mappletvos-version-min=9.0 -arch arm64 -S -o - %s | FileCheck %s + +int main() { return 0; } +// CHECK: .tvos_version_min 9, 0 diff --git a/clang/test/Driver/watchos-version-min.c b/clang/test/Driver/watchos-version-min.c new file mode 100644 index 00000000000..8f12285d4e4 --- /dev/null +++ b/clang/test/Driver/watchos-version-min.c @@ -0,0 +1,7 @@ +// REQUIRES: x86-registered-target +// REQUIRES: arm-registered-target +// RUN: %clang -target i386-apple-darwin10 -mwatchsimulator-version-min=2.0 -arch i386 -S -o - %s | FileCheck %s +// RUN: %clang -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -S -o - %s | FileCheck %s + +int main() { return 0; } +// CHECK: .watchos_version_min 2, 0 diff --git a/clang/test/Preprocessor/init-v7k-compat.c b/clang/test/Preprocessor/init-v7k-compat.c new file mode 100644 index 00000000000..3a1074753f1 --- /dev/null +++ b/clang/test/Preprocessor/init-v7k-compat.c @@ -0,0 +1,184 @@ +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv7k-apple-watchos2.0 < /dev/null | FileCheck %s + +// Check that the chosen types for things like size_t, ptrdiff_t etc are as +// expected + +// CHECK-NOT: #define _LP64 1 +// CHECK-NOT: #define __AARCH_BIG_ENDIAN 1 +// CHECK-NOT: #define __ARM_BIG_ENDIAN 1 +// CHECK: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// CHECK: #define __CHAR16_TYPE__ unsigned short +// CHECK: #define __CHAR32_TYPE__ unsigned int +// CHECK: #define __CHAR_BIT__ 8 +// CHECK: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// CHECK: #define __DBL_DIG__ 15 +// CHECK: #define __DBL_EPSILON__ 2.2204460492503131e-16 +// CHECK: #define __DBL_HAS_DENORM__ 1 +// CHECK: #define __DBL_HAS_INFINITY__ 1 +// CHECK: #define __DBL_HAS_QUIET_NAN__ 1 +// CHECK: #define __DBL_MANT_DIG__ 53 +// CHECK: #define __DBL_MAX_10_EXP__ 308 +// CHECK: #define __DBL_MAX_EXP__ 1024 +// CHECK: #define __DBL_MAX__ 1.7976931348623157e+308 +// CHECK: #define __DBL_MIN_10_EXP__ (-307) +// CHECK: #define __DBL_MIN_EXP__ (-1021) +// CHECK: #define __DBL_MIN__ 2.2250738585072014e-308 +// CHECK: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__ +// CHECK: #define __FLT_DENORM_MIN__ 1.40129846e-45F +// CHECK: #define __FLT_DIG__ 6 +// CHECK: #define __FLT_EPSILON__ 1.19209290e-7F +// CHECK: #define __FLT_EVAL_METHOD__ 0 +// CHECK: #define __FLT_HAS_DENORM__ 1 +// CHECK: #define __FLT_HAS_INFINITY__ 1 +// CHECK: #define __FLT_HAS_QUIET_NAN__ 1 +// CHECK: #define __FLT_MANT_DIG__ 24 +// CHECK: #define __FLT_MAX_10_EXP__ 38 +// CHECK: #define __FLT_MAX_EXP__ 128 +// CHECK: #define __FLT_MAX__ 3.40282347e+38F +// CHECK: #define __FLT_MIN_10_EXP__ (-37) +// CHECK: #define __FLT_MIN_EXP__ (-125) +// CHECK: #define __FLT_MIN__ 1.17549435e-38F +// CHECK: #define __FLT_RADIX__ 2 +// CHECK: #define __INT16_C_SUFFIX__ {{$}} +// CHECK: #define __INT16_FMTd__ "hd" +// CHECK: #define __INT16_FMTi__ "hi" +// CHECK: #define __INT16_MAX__ 32767 +// CHECK: #define __INT16_TYPE__ short +// CHECK: #define __INT32_C_SUFFIX__ {{$}} +// CHECK: #define __INT32_FMTd__ "d" +// CHECK: #define __INT32_FMTi__ "i" +// CHECK: #define __INT32_MAX__ 2147483647 +// CHECK: #define __INT32_TYPE__ int +// CHECK: #define __INT64_C_SUFFIX__ LL +// CHECK: #define __INT64_FMTd__ "lld" +// CHECK: #define __INT64_FMTi__ "lli" +// CHECK: #define __INT64_MAX__ 9223372036854775807LL +// CHECK: #define __INT64_TYPE__ long long int +// CHECK: #define __INT8_C_SUFFIX__ {{$}} +// CHECK: #define __INT8_FMTd__ "hhd" +// CHECK: #define __INT8_FMTi__ "hhi" +// CHECK: #define __INT8_MAX__ 127 +// CHECK: #define __INT8_TYPE__ signed char +// CHECK: #define __INTMAX_C_SUFFIX__ LL +// CHECK: #define __INTMAX_FMTd__ "lld" +// CHECK: #define __INTMAX_FMTi__ "lli" +// CHECK: #define __INTMAX_MAX__ 9223372036854775807LL +// CHECK: #define __INTMAX_TYPE__ long long int +// CHECK: #define __INTMAX_WIDTH__ 64 +// CHECK: #define __INTPTR_FMTd__ "ld" +// CHECK: #define __INTPTR_FMTi__ "li" +// CHECK: #define __INTPTR_MAX__ 2147483647L +// CHECK: #define __INTPTR_TYPE__ long int +// CHECK: #define __INTPTR_WIDTH__ 32 +// CHECK: #define __INT_FAST16_FMTd__ "hd" +// CHECK: #define __INT_FAST16_FMTi__ "hi" +// CHECK: #define __INT_FAST16_MAX__ 32767 +// CHECK: #define __INT_FAST16_TYPE__ short +// CHECK: #define __INT_FAST32_FMTd__ "d" +// CHECK: #define __INT_FAST32_FMTi__ "i" +// CHECK: #define __INT_FAST32_MAX__ 2147483647 +// CHECK: #define __INT_FAST32_TYPE__ int +// CHECK: #define __INT_FAST64_FMTd__ "lld" +// CHECK: #define __INT_FAST64_FMTi__ "lli" +// CHECK: #define __INT_FAST64_MAX__ 9223372036854775807LL +// CHECK: #define __INT_FAST64_TYPE__ long long int +// CHECK: #define __INT_FAST8_FMTd__ "hhd" +// CHECK: #define __INT_FAST8_FMTi__ "hhi" +// CHECK: #define __INT_FAST8_MAX__ 127 +// CHECK: #define __INT_FAST8_TYPE__ signed char +// CHECK: #define __INT_LEAST16_FMTd__ "hd" +// CHECK: #define __INT_LEAST16_FMTi__ "hi" +// CHECK: #define __INT_LEAST16_MAX__ 32767 +// CHECK: #define __INT_LEAST16_TYPE__ short +// CHECK: #define __INT_LEAST32_FMTd__ "d" +// CHECK: #define __INT_LEAST32_FMTi__ "i" +// CHECK: #define __INT_LEAST32_MAX__ 2147483647 +// CHECK: #define __INT_LEAST32_TYPE__ int +// CHECK: #define __INT_LEAST64_FMTd__ "lld" +// CHECK: #define __INT_LEAST64_FMTi__ "lli" +// CHECK: #define __INT_LEAST64_MAX__ 9223372036854775807LL +// CHECK: #define __INT_LEAST64_TYPE__ long long int +// CHECK: #define __INT_LEAST8_FMTd__ "hhd" +// CHECK: #define __INT_LEAST8_FMTi__ "hhi" +// CHECK: #define __INT_LEAST8_MAX__ 127 +// CHECK: #define __INT_LEAST8_TYPE__ signed char +// CHECK: #define __INT_MAX__ 2147483647 +// CHECK: #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L +// CHECK: #define __LDBL_DIG__ 15 +// CHECK: #define __LDBL_EPSILON__ 2.2204460492503131e-16L +// CHECK: #define __LDBL_HAS_DENORM__ 1 +// CHECK: #define __LDBL_HAS_INFINITY__ 1 +// CHECK: #define __LDBL_HAS_QUIET_NAN__ 1 +// CHECK: #define __LDBL_MANT_DIG__ 53 +// CHECK: #define __LDBL_MAX_10_EXP__ 308 +// CHECK: #define __LDBL_MAX_EXP__ 1024 +// CHECK: #define __LDBL_MAX__ 1.7976931348623157e+308L +// CHECK: #define __LDBL_MIN_10_EXP__ (-307) +// CHECK: #define __LDBL_MIN_EXP__ (-1021) +// CHECK: #define __LDBL_MIN__ 2.2250738585072014e-308L +// CHECK: #define __LONG_LONG_MAX__ 9223372036854775807LL +// CHECK: #define __LONG_MAX__ 2147483647L +// CHECK: #define __POINTER_WIDTH__ 32 +// CHECK: #define __PTRDIFF_TYPE__ long int +// CHECK: #define __PTRDIFF_WIDTH__ 32 +// CHECK: #define __SCHAR_MAX__ 127 +// CHECK: #define __SHRT_MAX__ 32767 +// CHECK: #define __SIG_ATOMIC_MAX__ 2147483647 +// CHECK: #define __SIG_ATOMIC_WIDTH__ 32 +// CHECK: #define __SIZEOF_DOUBLE__ 8 +// CHECK: #define __SIZEOF_FLOAT__ 4 +// CHECK: #define __SIZEOF_INT__ 4 +// CHECK: #define __SIZEOF_LONG_DOUBLE__ 8 +// CHECK: #define __SIZEOF_LONG_LONG__ 8 +// CHECK: #define __SIZEOF_LONG__ 4 +// CHECK: #define __SIZEOF_POINTER__ 4 +// CHECK: #define __SIZEOF_PTRDIFF_T__ 4 +// CHECK: #define __SIZEOF_SHORT__ 2 +// CHECK: #define __SIZEOF_SIZE_T__ 4 +// CHECK: #define __SIZEOF_WCHAR_T__ 4 +// CHECK: #define __SIZEOF_WINT_T__ 4 +// CHECK: #define __SIZE_MAX__ 4294967295UL +// CHECK: #define __SIZE_TYPE__ long unsigned int +// CHECK: #define __SIZE_WIDTH__ 32 +// CHECK: #define __UINT16_C_SUFFIX__ {{$}} +// CHECK: #define __UINT16_MAX__ 65535 +// CHECK: #define __UINT16_TYPE__ unsigned short +// CHECK: #define __UINT32_C_SUFFIX__ U +// CHECK: #define __UINT32_MAX__ 4294967295U +// CHECK: #define __UINT32_TYPE__ unsigned int +// CHECK: #define __UINT64_C_SUFFIX__ ULL +// CHECK: #define __UINT64_MAX__ 18446744073709551615ULL +// CHECK: #define __UINT64_TYPE__ long long unsigned int +// CHECK: #define __UINT8_C_SUFFIX__ {{$}} +// CHECK: #define __UINT8_MAX__ 255 +// CHECK: #define __UINT8_TYPE__ unsigned char +// CHECK: #define __UINTMAX_C_SUFFIX__ ULL +// CHECK: #define __UINTMAX_MAX__ 18446744073709551615ULL +// CHECK: #define __UINTMAX_TYPE__ long long unsigned int +// CHECK: #define __UINTMAX_WIDTH__ 64 +// CHECK: #define __UINTPTR_MAX__ 4294967295UL +// CHECK: #define __UINTPTR_TYPE__ long unsigned int +// CHECK: #define __UINTPTR_WIDTH__ 32 +// CHECK: #define __UINT_FAST16_MAX__ 65535 +// CHECK: #define __UINT_FAST16_TYPE__ unsigned short +// CHECK: #define __UINT_FAST32_MAX__ 4294967295U +// CHECK: #define __UINT_FAST32_TYPE__ unsigned int +// CHECK: #define __UINT_FAST64_MAX__ 18446744073709551615UL +// CHECK: #define __UINT_FAST64_TYPE__ long long unsigned int +// CHECK: #define __UINT_FAST8_MAX__ 255 +// CHECK: #define __UINT_FAST8_TYPE__ unsigned char +// CHECK: #define __UINT_LEAST16_MAX__ 65535 +// CHECK: #define __UINT_LEAST16_TYPE__ unsigned short +// CHECK: #define __UINT_LEAST32_MAX__ 4294967295U +// CHECK: #define __UINT_LEAST32_TYPE__ unsigned int +// CHECK: #define __UINT_LEAST64_MAX__ 18446744073709551615UL +// CHECK: #define __UINT_LEAST64_TYPE__ long long unsigned int +// CHECK: #define __UINT_LEAST8_MAX__ 255 +// CHECK: #define __UINT_LEAST8_TYPE__ unsigned char +// CHECK: #define __USER_LABEL_PREFIX__ _ +// CHECK: #define __WCHAR_MAX__ 2147483647 +// CHECK: #define __WCHAR_TYPE__ int +// CHECK-NOT: #define __WCHAR_UNSIGNED__ 1 +// CHECK: #define __WCHAR_WIDTH__ 32 +// CHECK: #define __WINT_TYPE__ int +// CHECK: #define __WINT_WIDTH__ 32 diff --git a/clang/test/SemaObjC/bool-type.m b/clang/test/SemaObjC/bool-type.m new file mode 100644 index 00000000000..830a7ef0614 --- /dev/null +++ b/clang/test/SemaObjC/bool-type.m @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple thumbv7s-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR +// RUN: %clang_cc1 -triple thumbv7k-apple-watchos2.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL +// RUN: %clang_cc1 -triple i386-apple-watchos2.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL +// RUN: %clang_cc1 -triple arm64-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL +// RUN: %clang_cc1 -triple x86_64-apple-ios8.0 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-BOOL +// RUN: %clang_cc1 -triple i386-apple-macosx10.10 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -ast-dump "%s" 2>&1 | FileCheck %s --check-prefix CHECK-CHAR + +// CHECK-CHAR: ObjCBoolLiteralExpr {{.*}} 'signed char' __objc_yes +// CHECK-BOOL: ObjCBoolLiteralExpr {{.*}} '_Bool' __objc_yes + +int var = __objc_yes; |

