diff options
author | Robert Lytton <robert@xmos.com> | 2013-08-13 09:43:10 +0000 |
---|---|---|
committer | Robert Lytton <robert@xmos.com> | 2013-08-13 09:43:10 +0000 |
commit | 0e07649ae51fb4e374d93b69dfabf3845e647601 (patch) | |
tree | c3b97c568bfc07e80a1af332520fbceb5edcf96c /clang/test | |
parent | e9cab2faa6226b5aeeb4542f54c80f8cb18780eb (diff) | |
download | bcm5719-llvm-0e07649ae51fb4e374d93b69dfabf3845e647601.tar.gz bcm5719-llvm-0e07649ae51fb4e374d93b69dfabf3845e647601.zip |
Add XCore target
llvm-svn: 188258
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/xcore-abi.c | 35 | ||||
-rw-r--r-- | clang/test/Driver/xcore-opts.c | 15 | ||||
-rw-r--r-- | clang/test/Preprocessor/init.c | 3 | ||||
-rw-r--r-- | clang/test/Preprocessor/stdint.c | 108 |
4 files changed, 161 insertions, 0 deletions
diff --git a/clang/test/CodeGen/xcore-abi.c b/clang/test/CodeGen/xcore-abi.c new file mode 100644 index 00000000000..fcdefebe23a --- /dev/null +++ b/clang/test/CodeGen/xcore-abi.c @@ -0,0 +1,35 @@ +// RUN: %clang -target xcore -O1 -o - -emit-llvm -S %s | FileCheck %s + +// CHECK: target datalayout = "e-p:32:32:32-a0:0:32-n32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f16:16:32-f32:32:32-f64:32:32" +// CHECK: target triple = "xcore" + +#include <stdarg.h> +struct x { int a; }; +void testva (int n, ...) { + va_list ap; + // CHECK: %ap = alloca i8*, align 4 + + char* v1 = va_arg (ap, char*); + // CHECK: %0 = va_arg i8** %ap, i8* + + int v2 = va_arg (ap, int); + // CHECK: %1 = va_arg i8** %ap, i32 + + long long int v3 = va_arg (ap, long long int); + // CHECK: %2 = va_arg i8** %ap, i64 + + //struct x t = va_arg (ap, struct x); + //cannot compile aggregate va_arg expressions yet +} + +void testbuiltin (void) { +// CHECK: %0 = tail call i32 @llvm.xcore.getid() +// CHECK: %1 = tail call i32 @llvm.xcore.getps(i32 %0) +// CHECK: %2 = tail call i32 @llvm.xcore.bitrev(i32 %1) +// CHECK: tail call void @llvm.xcore.setps(i32 %0, i32 %2) + int i = __builtin_getid(); + unsigned int ui = __builtin_getps(i); + ui = __builtin_bitrev(ui); + __builtin_setps(i,ui); + +} diff --git a/clang/test/Driver/xcore-opts.c b/clang/test/Driver/xcore-opts.c new file mode 100644 index 00000000000..137e28f3a69 --- /dev/null +++ b/clang/test/Driver/xcore-opts.c @@ -0,0 +1,15 @@ +// RUN: %clang -target xcore -O1 -o - -emit-llvm -S %s | FileCheck %s + +// CHECK: @g1 = global +int g1; +// CHECK: @g2 = common global i32 0, align 4 +int g2 __attribute__((common)); + +// CHECK: define zeroext i8 @testchar() +// CHECK: ret i8 -1 +char testchar (void) { + return (char)-1; +} + +// CHECK: "no-frame-pointer-elim"="false" +// CHECK: "no-frame-pointer-elim-non-leaf"="false" diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index f25f3cdd920..d1f256a1ac2 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -2946,3 +2946,6 @@ // ANDROID: __ANDROID__ 1 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd < /dev/null | FileCheck -check-prefix PPC64-FREEBSD %s // PPC64-FREEBSD-NOT: #define __LONG_DOUBLE_128__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=xcore-none-none < /dev/null | FileCheck -check-prefix XCORE %s +// XCORE:#define __XS1B__ 1 diff --git a/clang/test/Preprocessor/stdint.c b/clang/test/Preprocessor/stdint.c index cf6f341b357..971aea45ecd 100644 --- a/clang/test/Preprocessor/stdint.c +++ b/clang/test/Preprocessor/stdint.c @@ -963,6 +963,114 @@ // I386_MINGW32:WCHAR_MIN_ 0U // // +// RUN: %clang_cc1 -E -ffreestanding -triple=xcore-none-none %s | FileCheck -check-prefix XCORE %s +// +// XCORE:typedef signed long long int int64_t; +// XCORE:typedef unsigned long long int uint64_t; +// XCORE:typedef int64_t int_least64_t; +// XCORE:typedef uint64_t uint_least64_t; +// XCORE:typedef int64_t int_fast64_t; +// XCORE:typedef uint64_t uint_fast64_t; +// +// XCORE:typedef signed int int32_t; +// XCORE:typedef unsigned int uint32_t; +// XCORE:typedef int32_t int_least32_t; +// XCORE:typedef uint32_t uint_least32_t; +// XCORE:typedef int32_t int_fast32_t; +// XCORE:typedef uint32_t uint_fast32_t; +// +// XCORE:typedef signed short int16_t; +// XCORE:typedef unsigned short uint16_t; +// XCORE:typedef int16_t int_least16_t; +// XCORE:typedef uint16_t uint_least16_t; +// XCORE:typedef int16_t int_fast16_t; +// XCORE:typedef uint16_t uint_fast16_t; +// +// XCORE:typedef signed char int8_t; +// XCORE:typedef unsigned char uint8_t; +// XCORE:typedef int8_t int_least8_t; +// XCORE:typedef uint8_t uint_least8_t; +// XCORE:typedef int8_t int_fast8_t; +// XCORE:typedef uint8_t uint_fast8_t; +// +// XCORE:typedef int32_t intptr_t; +// XCORE:typedef uint32_t uintptr_t; +// +// XCORE:typedef long long int intmax_t; +// XCORE:typedef long long unsigned int uintmax_t; +// +// XCORE:INT8_MAX_ 127 +// XCORE:INT8_MIN_ (-127 -1) +// XCORE:UINT8_MAX_ 255 +// XCORE:INT_LEAST8_MIN_ (-127 -1) +// XCORE:INT_LEAST8_MAX_ 127 +// XCORE:UINT_LEAST8_MAX_ 255 +// XCORE:INT_FAST8_MIN_ (-127 -1) +// XCORE:INT_FAST8_MAX_ 127 +// XCORE:UINT_FAST8_MAX_ 255 +// +// XCORE:INT16_MAX_ 32767 +// XCORE:INT16_MIN_ (-32767 -1) +// XCORE:UINT16_MAX_ 65535 +// XCORE:INT_LEAST16_MIN_ (-32767 -1) +// XCORE:INT_LEAST16_MAX_ 32767 +// XCORE:UINT_LEAST16_MAX_ 65535 +// XCORE:INT_FAST16_MIN_ (-32767 -1) +// XCORE:INT_FAST16_MAX_ 32767 +// XCORE:UINT_FAST16_MAX_ 65535 +// +// XCORE:INT32_MAX_ 2147483647 +// XCORE:INT32_MIN_ (-2147483647 -1) +// XCORE:UINT32_MAX_ 4294967295U +// XCORE:INT_LEAST32_MIN_ (-2147483647 -1) +// XCORE:INT_LEAST32_MAX_ 2147483647 +// XCORE:UINT_LEAST32_MAX_ 4294967295U +// XCORE:INT_FAST32_MIN_ (-2147483647 -1) +// XCORE:INT_FAST32_MAX_ 2147483647 +// XCORE:UINT_FAST32_MAX_ 4294967295U +// +// XCORE:INT64_MAX_ 9223372036854775807LL +// XCORE:INT64_MIN_ (-9223372036854775807LL -1) +// XCORE:UINT64_MAX_ 18446744073709551615ULL +// XCORE:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// XCORE:INT_LEAST64_MAX_ 9223372036854775807LL +// XCORE:UINT_LEAST64_MAX_ 18446744073709551615ULL +// XCORE:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// XCORE:INT_FAST64_MAX_ 9223372036854775807LL +// XCORE:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// XCORE:INTPTR_MIN_ (-2147483647 -1) +// XCORE:INTPTR_MAX_ 2147483647 +// XCORE:UINTPTR_MAX_ 4294967295U +// XCORE:PTRDIFF_MIN_ (-2147483647 -1) +// XCORE:PTRDIFF_MAX_ 2147483647 +// XCORE:SIZE_MAX_ 4294967295U +// +// XCORE:INTMAX_MIN_ (-9223372036854775807LL -1) +// XCORE:INTMAX_MAX_ 9223372036854775807LL +// XCORE:UINTMAX_MAX_ 18446744073709551615ULL +// +// XCORE:SIG_ATOMIC_MIN_ (-2147483647 -1) +// XCORE:SIG_ATOMIC_MAX_ 2147483647 +// XCORE:WINT_MIN_ (-2147483647 -1) +// XCORE:WINT_MAX_ 2147483647 +// +// XCORE:WCHAR_MAX_ 2147483647 +// XCORE:WCHAR_MIN_ (-2147483647 -1) +// +// XCORE:INT8_C_(0) 0 +// XCORE:UINT8_C_(0) 0U +// XCORE:INT16_C_(0) 0 +// XCORE:UINT16_C_(0) 0U +// XCORE:INT32_C_(0) 0 +// XCORE:UINT32_C_(0) 0U +// XCORE:INT64_C_(0) 0LL +// XCORE:UINT64_C_(0) 0ULL +// +// XCORE:INTMAX_C_(0) 0LL +// XCORE:UINTMAX_C_(0) 0ULL +// +// // stdint.h forms several macro definitions by pasting together identifiers // to form names (eg. int32_t is formed from int ## 32 ## _t). The following // case tests that these joining operations are performed correctly even if |