summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2013-12-02 10:18:31 +0000
committerRobert Lytton <robert@xmos.com>2013-12-02 10:18:31 +0000
commit883abacb5bd0e3b759f802a07f11771454804a4d (patch)
tree667a3cd41f80977e85f0fbb7d8d7ba8b151c8eb3 /test
parent7112fa0523039a7316000e034a803d0f052133aa (diff)
downloadllvm-883abacb5bd0e3b759f802a07f11771454804a4d.tar.gz
llvm-883abacb5bd0e3b759f802a07f11771454804a4d.tar.bz2
llvm-883abacb5bd0e3b759f802a07f11771454804a4d.tar.xz
XCore target: Add large code model
When using large code model: Global objects larger than 'CodeModelLargeSize' bytes are placed in sections named with a trailing ".large" The folded global address of such objects are lowered into the const pool. During inspection it was noted that LowerConstantPool() was using a default offset of zero. A fix was made, but due to only offsets of zero being generated, testing only verifies the change is not detrimental. Correct the flags emitted for explicitly specified sections. We assume the size of the object queried by getSectionForConstant() is never greater than CodeModelLargeSize. To handle greater than CodeModelLargeSize, changes to AsmPrinter would be required. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/XCore/codemodel.ll65
1 files changed, 64 insertions, 1 deletions
diff --git a/test/CodeGen/XCore/codemodel.ll b/test/CodeGen/XCore/codemodel.ll
index f5a980524d..e86627cc41 100644
--- a/test/CodeGen/XCore/codemodel.ll
+++ b/test/CodeGen/XCore/codemodel.ll
@@ -1,5 +1,12 @@
-; RUN: llc < %s -march=xcore | FileCheck %s
+; RUN: not llc < %s -march=xcore -code-model=medium 2>&1 | FileCheck %s -check-prefix=BAD_CM
+; RUN: not llc < %s -march=xcore -code-model=kernel 2>&1 | FileCheck %s -check-prefix=BAD_CM
+; BAD_CM: Target only supports CodeModel Small or Large
+
+
+; RUN: llc < %s -march=xcore -code-model=default | FileCheck %s
+; RUN: llc < %s -march=xcore -code-model=small | FileCheck %s
+; RUN: llc < %s -march=xcore -code-model=large | FileCheck %s -check-prefix=LARGE
; CHECK: .section .cp.rodata.cst4,"aMc",@progbits,4
; CHECK: .long 65536
@@ -25,6 +32,40 @@
; CHECK: ldw r1, dp[s+36]
; CHECK: add r0, r0, r1
; CHECK: retsp 0
+;
+; LARGE: .section .cp.rodata.cst4,"aMc",@progbits,4
+; LARGE: .long 65536
+; LARGE: .section .cp.rodata,"ac",@progbits
+; LARGE: .long l
+; LARGE: .long l+4
+; LARGE: .long l+392
+; LARGE: .long l+396
+; LARGE: .text
+; LARGE-LABEL: f:
+; LARGE: ldc r1, 65532
+; LARGE: add r1, r0, r1
+; LARGE: ldw r1, r1[0]
+; LARGE: ldw r2, cp[.LCPI0_0]
+; LARGE: add r0, r0, r2
+; LARGE: ldw r0, r0[0]
+; LARGE: add r0, r1, r0
+; LARGE: ldw r1, cp[.LCPI0_1]
+; LARGE: ldw r1, r1[0]
+; LARGE: add r0, r0, r1
+; LARGE: ldw r1, cp[.LCPI0_2]
+; LARGE: ldw r1, r1[0]
+; LARGE: add r0, r0, r1
+; LARGE: ldw r1, cp[.LCPI0_3]
+; LARGE: ldw r1, r1[0]
+; LARGE: add r0, r0, r1
+; LARGE: ldw r1, cp[.LCPI0_4]
+; LARGE: ldw r1, r1[0]
+; LARGE: add r0, r0, r1
+; LARGE: ldw r1, dp[s]
+; LARGE: add r0, r0, r1
+; LARGE: ldw r1, dp[s+36]
+; LARGE: add r0, r0, r1
+; LARGE: retsp 0
define i32 @f(i32* %i) {
entry:
%0 = getelementptr inbounds i32* %i, i32 16383
@@ -50,17 +91,39 @@ entry:
; CHECK: .section .dp.bss,"awd",@nobits
; CHECK-LABEL: l:
; CHECK: .space 400
+; LARGE: .section .dp.bss.large,"awd",@nobits
+; LARGE-LABEL: l:
+; LARGE: .space 400
@l = global [100 x i32] zeroinitializer
; CHECK-LABEL: s:
; CHECK: .space 40
+; LARGE: .section .dp.bss,"awd",@nobits
+; LARGE-LABEL: s:
+; LARGE: .space 40
@s = global [10 x i32] zeroinitializer
; CHECK: .section .cp.rodata,"ac",@progbits
; CHECK-LABEL: cl:
; CHECK: .space 400
+; LARGE: .section .cp.rodata.large,"ac",@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-LABEL: cs:
+; LARGE: .space 40
@cs = constant [10 x i32] zeroinitializer
+
+; CHECK: .section .cp.namedsection,"ac",@progbits
+; CHECK-LABEL: cpsec:
+; CHECK: .long 0
+@cpsec = global i32 0, section ".cp.namedsection"
+
+; CHECK: .section .dp.namedsection,"awd",@progbits
+; CHECK-LABEL: dpsec:
+; CHECK: .long 0
+@dpsec = global i32 0, section ".dp.namedsection"