summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2014-02-11 10:36:26 +0000
committerRobert Lytton <robert@xmos.com>2014-02-11 10:36:26 +0000
commitd3abd0b648dd795dc481cc06169714738eb9bbdc (patch)
tree2f9810bcff0e274928ebc36fb8acfabdb7e2cc76 /test
parent04a573a41f037eae148f70bf2038602f7e32dd71 (diff)
downloadllvm-d3abd0b648dd795dc481cc06169714738eb9bbdc.tar.gz
llvm-d3abd0b648dd795dc481cc06169714738eb9bbdc.tar.bz2
llvm-d3abd0b648dd795dc481cc06169714738eb9bbdc.tar.xz
XCore target: fix const section handling
Xcore target ABI requires const data that is externally visible to be handled differently if it has C-language linkage rather than C++ language linkage. Clang now emits ".cp.rodata" section information. All other externally visible constant data will be placed in the DP section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/XCore/codemodel.ll24
-rw-r--r--test/CodeGen/XCore/exception.ll3
-rw-r--r--test/CodeGen/XCore/globals.ll53
-rw-r--r--test/CodeGen/XCore/llvm-intrinsics.ll5
-rw-r--r--test/CodeGen/XCore/load.ll2
5 files changed, 67 insertions, 20 deletions
diff --git a/test/CodeGen/XCore/codemodel.ll b/test/CodeGen/XCore/codemodel.ll
index cc532ea7de..0245893c47 100644
--- a/test/CodeGen/XCore/codemodel.ll
+++ b/test/CodeGen/XCore/codemodel.ll
@@ -171,27 +171,43 @@ entry:
; LARGE: .space 40
@s = global [10 x i32] zeroinitializer
-; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: .section .dp.rodata,"awd",@progbits
; CHECK-LABEL: cl:
; CHECK: .space 400
-; LARGE: .section .cp.rodata.large,"ac",@progbits
+; LARGE: .section .dp.rodata.large,"awd",@progbits
; LARGE-LABEL: cl:
; LARGE: .space 400
@cl = constant [100 x i32] zeroinitializer
; CHECK-LABEL: cs:
; CHECK: .space 40
-; LARGE: .section .cp.rodata,"ac",@progbits
+; LARGE: .section .dp.rodata,"awd",@progbits
; LARGE-LABEL: cs:
; LARGE: .space 40
@cs = constant [10 x i32] zeroinitializer
+; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK-LABEL: icl:
+; CHECK: .space 400
+; LARGE: .section .cp.rodata.large,"ac",@progbits
+; LARGE-LABEL: icl:
+; LARGE: .space 400
+@icl = internal constant [100 x i32] zeroinitializer
+
+; CHECK-LABEL: cs:
+; CHECK: .space 40
+; LARGE: .section .cp.rodata,"ac",@progbits
+; LARGE-LABEL: cs:
+; LARGE: .space 40
+@ics = internal constant [10 x i32] zeroinitializer
+
; CHECK: .section .cp.namedsection,"ac",@progbits
; CHECK-LABEL: cpsec:
; CHECK: .long 0
-@cpsec = global i32 0, section ".cp.namedsection"
+@cpsec = constant i32 0, section ".cp.namedsection"
; CHECK: .section .dp.namedsection,"awd",@progbits
; CHECK-LABEL: dpsec:
; CHECK: .long 0
@dpsec = global i32 0, section ".dp.namedsection"
+
diff --git a/test/CodeGen/XCore/exception.ll b/test/CodeGen/XCore/exception.ll
index 8018cdcada..3179fcdfcf 100644
--- a/test/CodeGen/XCore/exception.ll
+++ b/test/CodeGen/XCore/exception.ll
@@ -29,9 +29,8 @@ entry:
; CHECK: .cfi_offset 15, 0
; CHECK: ldc r0, 4
; CHECK: bl __cxa_allocate_exception
-; CHECK: ldaw r11, cp[_ZTIi]
+; CHECK: ldaw r1, dp[_ZTIi]
; CHECK: ldc r2, 0
-; CHECK: mov r1, r11
; CHECK: bl __cxa_throw
define void @fn_throw() {
entry:
diff --git a/test/CodeGen/XCore/globals.ll b/test/CodeGen/XCore/globals.ll
index b3a872bb68..04e135c25c 100644
--- a/test/CodeGen/XCore/globals.ll
+++ b/test/CodeGen/XCore/globals.ll
@@ -17,11 +17,18 @@ entry:
define i32 *@addr_G3() {
entry:
; CHECK-LABEL: addr_G3:
-; CHECK: ldaw r11, cp[G3]
-; CHECK: mov r0, r11
+; CHECK: ldaw r0, dp[G3]
ret i32* @G3
}
+define i32 *@addr_iG3() {
+entry:
+; CHECK-LABEL: addr_iG3:
+; CHECK: ldaw r11, cp[iG3]
+; CHECK: mov r0, r11
+ ret i32* @iG3
+}
+
define i32 **@addr_G4() {
entry:
; CHECK-LABEL: addr_G4:
@@ -32,11 +39,18 @@ entry:
define i32 **@addr_G5() {
entry:
; CHECK-LABEL: addr_G5:
-; CHECK: ldaw r11, cp[G5]
-; CHECK: mov r0, r11
+; CHECK: ldaw r0, dp[G5]
ret i32** @G5
}
+define i32 **@addr_iG5() {
+entry:
+; CHECK-LABEL: addr_iG5:
+; CHECK: ldaw r11, cp[iG5]
+; CHECK: mov r0, r11
+ ret i32** @iG5
+}
+
define i32 **@addr_G6() {
entry:
; CHECK-LABEL: addr_G6:
@@ -47,11 +61,18 @@ entry:
define i32 **@addr_G7() {
entry:
; CHECK-LABEL: addr_G7:
-; CHECK: ldaw r11, cp[G7]
-; CHECK: mov r0, r11
+; CHECK: ldaw r0, dp[G7]
ret i32** @G7
}
+define i32 **@addr_iG7() {
+entry:
+; CHECK-LABEL: addr_iG7:
+; CHECK: ldaw r11, cp[iG7]
+; CHECK: mov r0, r11
+ ret i32** @iG7
+}
+
define i32 *@addr_G8() {
entry:
; CHECK-LABEL: addr_G8:
@@ -68,26 +89,38 @@ entry:
; CHECK: G2:
@G3 = unnamed_addr constant i32 9401
-; CHECK: .section .cp.rodata.cst4,"aMc",@progbits,4
+; CHECK: .section .dp.rodata,"awd",@progbits
; CHECK: G3:
+@iG3 = internal constant i32 9401
+; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: iG3:
+
@G4 = global i32* @G1
; CHECK: .section .dp.data,"awd",@progbits
; CHECK: G4:
@G5 = unnamed_addr constant i32* @G1
-; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: .section .dp.rodata,"awd",@progbits
; CHECK: G5:
+@iG5 = internal unnamed_addr constant i32* @G1
+; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: iG5:
+
@G6 = global i32* @G8
; CHECK: .section .dp.data,"awd",@progbits
; CHECK: G6:
@G7 = unnamed_addr constant i32* @G8
-; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: .section .dp.rodata,"awd",@progbits
; CHECK: G7:
-@G8 = internal global i32 9312
+@iG7 = internal unnamed_addr constant i32* @G8
+; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: iG7:
+
+@G8 = global i32 9312
; CHECK: .section .dp.data,"awd",@progbits
; CHECK: G8:
diff --git a/test/CodeGen/XCore/llvm-intrinsics.ll b/test/CodeGen/XCore/llvm-intrinsics.ll
index be5fd78cd2..e7c78af212 100644
--- a/test/CodeGen/XCore/llvm-intrinsics.ll
+++ b/test/CodeGen/XCore/llvm-intrinsics.ll
@@ -119,13 +119,12 @@ entry:
; CHECK-LABEL: EH2
; CHECK: entsp 1
; CHECK: bl foo
-; CHECK-NEXT: ldw r0, cp[offset]
+; CHECK-NEXT: ldw r0, dp[offset]
; CHECK-NEXT: ldc r1, 4
; CHECK-NEXT: ldaw r2, sp[0]
; CHECK-NEXT: add r1, r2, r1
; CHECK-NEXT: add r2, r1, r0
-; CHECK-NEXT: ldaw r11, cp[handler]
-; CHECK-NEXT: mov r3, r11
+; CHECK-NEXT: ldaw r3, dp[handler]
; CHECK-NEXT: set sp, r2
; CHECK-NEXT: bau r3
call void (...)* @foo()
diff --git a/test/CodeGen/XCore/load.ll b/test/CodeGen/XCore/load.ll
index 0622f1cd13..c7fc2a33db 100644
--- a/test/CodeGen/XCore/load.ll
+++ b/test/CodeGen/XCore/load.ll
@@ -40,7 +40,7 @@ entry:
ret i32 %2
}
-@GConst = external constant i32
+@GConst = internal constant i32 42
define i32 @load_cp() nounwind {
entry:
; CHECK-LABEL: load_cp: