aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/xcore-abi.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/xcore-abi.c')
-rw-r--r--test/CodeGen/xcore-abi.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/test/CodeGen/xcore-abi.c b/test/CodeGen/xcore-abi.c
index 10881de7cec2..6dbc44b5595d 100644
--- a/test/CodeGen/xcore-abi.c
+++ b/test/CodeGen/xcore-abi.c
@@ -1,3 +1,4 @@
+// REQUIRES: xcore-registered-target
// RUN: %clang_cc1 -triple xcore -verify %s
_Static_assert(sizeof(long long) == 8, "sizeof long long is wrong");
_Static_assert(_Alignof(long long) == 4, "alignof long long is wrong");
@@ -7,11 +8,15 @@ _Static_assert(_Alignof(double) == 4, "alignof double is wrong");
// RUN: %clang_cc1 -triple xcore-unknown-unknown -fno-signed-char -fno-common -emit-llvm -o - %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-unknown-unknown"
+// CHECK: @cgx = external constant i32, section ".cp.rodata"
+extern const int cgx;
+int fcgx() { return cgx;}
// CHECK: @g1 = global i32 0, align 4
int g1;
+// CHECK: @cg1 = constant i32 0, section ".cp.rodata", align 4
+const int cg1;
#include <stdarg.h>
struct x { int a[5]; };
@@ -66,7 +71,7 @@ void testva (int n, ...) {
// CHECK:[[V2:%[a-z0-9]+]] = bitcast i64* [[V]] to i8*
// CHECK: call void @f(i8* [[V2]])
- struct x v5 = va_arg (ap, struct x); // typical agregate type
+ struct x v5 = va_arg (ap, struct x); // typical aggregate type
f(&v5);
// CHECK: [[I:%[a-z0-9]+]] = load i8** [[AP]]
// CHECK: [[I2:%[a-z0-9]+]] = bitcast i8* [[I]] to %struct.x**
@@ -79,7 +84,7 @@ void testva (int n, ...) {
// CHECK: [[V2:%[a-z0-9]+]] = bitcast %struct.x* [[V]] to i8*
// CHECK: call void @f(i8* [[V2]])
- int* v6 = va_arg (ap, int[4]); // an unusual agregate type
+ int* v6 = va_arg (ap, int[4]); // an unusual aggregate type
f(v6);
// CHECK: [[I:%[a-z0-9]+]] = load i8** [[AP]]
// CHECK: [[I2:%[a-z0-9]+]] = bitcast i8* [[I]] to [4 x i32]**
@@ -113,10 +118,18 @@ void testbuiltin (void) {
// CHECK: call i32 @llvm.xcore.getps(i32 {{%[a-z0-9]+}})
// CHECK: call i32 @llvm.xcore.bitrev(i32 {{%[a-z0-9]+}})
// CHECK: call void @llvm.xcore.setps(i32 {{%[a-z0-9]+}}, i32 {{%[a-z0-9]+}})
- int i = __builtin_getid();
- unsigned int ui = __builtin_getps(i);
+ volatile int i = __builtin_getid();
+ volatile unsigned int ui = __builtin_getps(i);
ui = __builtin_bitrev(ui);
__builtin_setps(i,ui);
+
+ // CHECK: store volatile i32 0, i32* {{%[a-z0-9]+}}, align 4
+ // CHECK: store volatile i32 1, i32* {{%[a-z0-9]+}}, align 4
+ // CHECK: store volatile i32 -1, i32* {{%[a-z0-9]+}}, align 4
+ volatile int res;
+ res = __builtin_eh_return_data_regno(0);
+ res = __builtin_eh_return_data_regno(1);
+ res = __builtin_eh_return_data_regno(2);
}
// CHECK-LABEL: define zeroext i8 @testchar()