diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
commit | 5ca98fd98791947eba83a1ed3f2c8191ef7afa6c (patch) | |
tree | f5944309621cee4fe0976be6f9ac619b7ebfc4c2 /test/CodeGen/Thumb | |
parent | 68bcb7db193e4bc81430063148253d30a791023e (diff) | |
download | src-5ca98fd98791947eba83a1ed3f2c8191ef7afa6c.tar.gz src-5ca98fd98791947eba83a1ed3f2c8191ef7afa6c.zip |
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):vendor/llvm/llvm-release_350-r216957
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=274955
svn path=/vendor/llvm/llvm-release_35-r216957/; revision=274956; tag=vendor/llvm/llvm-release_350-r216957
Diffstat (limited to 'test/CodeGen/Thumb')
35 files changed, 599 insertions, 42 deletions
diff --git a/test/CodeGen/Thumb/2009-06-18-ThumbCommuteMul.ll b/test/CodeGen/Thumb/2009-06-18-ThumbCommuteMul.ll index 5c883b3930dc..ca6df7cdab31 100644 --- a/test/CodeGen/Thumb/2009-06-18-ThumbCommuteMul.ll +++ b/test/CodeGen/Thumb/2009-06-18-ThumbCommuteMul.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb | grep r0 | count 1 +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @a(i32 %x, i32 %y) nounwind readnone { entry: @@ -6,3 +6,5 @@ entry: ret i32 %mul } +; CHECK: r0 + diff --git a/test/CodeGen/Thumb/2010-06-18-SibCallCrash.ll b/test/CodeGen/Thumb/2010-06-18-SibCallCrash.ll index ad8b064bf4bd..e1efd3b7238f 100644 --- a/test/CodeGen/Thumb/2010-06-18-SibCallCrash.ll +++ b/test/CodeGen/Thumb/2010-06-18-SibCallCrash.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=thumb < %s +; RUN: llc -mtriple=thumb-eabi %s -o /dev/null ; rdar://8104457 define arm_apcscc void @t(i32* %m) nounwind { diff --git a/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll b/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll index b87bf24993a1..ffc9584199cf 100644 --- a/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll +++ b/test/CodeGen/Thumb/2010-07-15-debugOrdering.ll @@ -151,5 +151,5 @@ declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone !98 = metadata !{i32 52, i32 0, metadata !1, null} !101 = metadata !{metadata !"ggEdgeDiscrepancy.cc", metadata !"/Volumes/Home/grosbaj/sources/llvm-externals/speccpu2000/benchspec/CINT2000/252.eon/src"} !102 = metadata !{i32 0} -!103 = metadata !{metadata !3} +!103 = metadata !{metadata !3, metadata !77} !104 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} diff --git a/test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll b/test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll new file mode 100644 index 000000000000..ae663697ebeb --- /dev/null +++ b/test/CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug.ll @@ -0,0 +1,18 @@ +; RUN: llc < %s -mtriple=thumbv6m-eabi -o - | FileCheck %s +; XFAIL: * + +define void @foo(i32* %A) #0 { +entry: +; CHECK-LABEL: foo: +; CHECK: push {r7, lr} +; CHECK: ldm [[REG0:r[0-9]]]!, +; CHECK-NEXT: subs [[REG0]] +; CHECK-NEXT: bl + %0 = load i32* %A, align 4 + %arrayidx1 = getelementptr inbounds i32* %A, i32 1 + %1 = load i32* %arrayidx1, align 4 + tail call void @bar(i32* %A, i32 %0, i32 %1) #2 + ret void +} + +declare void @bar(i32*, i32, i32) #1 diff --git a/test/CodeGen/Thumb/DbgValueOtherTargets.test b/test/CodeGen/Thumb/DbgValueOtherTargets.test index afb18a43be47..557892b06233 100644 --- a/test/CodeGen/Thumb/DbgValueOtherTargets.test +++ b/test/CodeGen/Thumb/DbgValueOtherTargets.test @@ -1 +1 @@ -RUN: llc -O0 -march=thumb -asm-verbose < %S/../Inputs/DbgValueOtherTargets.ll | FileCheck %S/../Inputs/DbgValueOtherTargets.ll +RUN: llc -O0 -mtriple=thumb-eabi -asm-verbose %S/../Inputs/DbgValueOtherTargets.ll -o - | FileCheck %S/../Inputs/DbgValueOtherTargets.ll diff --git a/test/CodeGen/Thumb/barrier.ll b/test/CodeGen/Thumb/barrier.ll index 1c27fa09884f..92d9bb2097ff 100644 --- a/test/CodeGen/Thumb/barrier.ll +++ b/test/CodeGen/Thumb/barrier.ll @@ -1,6 +1,6 @@ -; RUN: llc < %s -mtriple=thumbv6-apple-darwin | FileCheck %s -check-prefix=V6 -; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=-db | FileCheck %s -check-prefix=V6 -; RUN: llc < %s -march=thumb -mcpu=cortex-m0 | FileCheck %s -check-prefix=V6M +; RUN: llc -mtriple=thumbv6-apple-darwin %s -o - | FileCheck %s -check-prefix=V6 +; RUN: llc -mtriple=thumbv7-apple-darwin -mattr=-db %s -o - | FileCheck %s -check-prefix=V6 +; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-m0 %s -o - | FileCheck %s -check-prefix=V6M define void @t1() { ; V6-LABEL: t1: diff --git a/test/CodeGen/Thumb/cortex-m0-unaligned-access.ll b/test/CodeGen/Thumb/cortex-m0-unaligned-access.ll new file mode 100644 index 000000000000..c4403fe7efe6 --- /dev/null +++ b/test/CodeGen/Thumb/cortex-m0-unaligned-access.ll @@ -0,0 +1,13 @@ +; RUN: llc -mtriple=thumbv6m-apple-unknown-macho < %s | FileCheck --check-prefix=V6M %s +; RUN: llc -mtriple=thumbv7m-apple-unknown-macho < %s | FileCheck --check-prefix=V7M %s + +define i32 @split_load(i32* %p) nounwind { +; V6M-LABEL: split_load +; V6M: ldrh +; V6M: ldrh +; V7M-LABEL: split_load +; V7M-NOT: ldrh +; V7M: bx lr + %val = load i32* %p, align 2 + ret i32 %val +} diff --git a/test/CodeGen/Thumb/fastcc.ll b/test/CodeGen/Thumb/fastcc.ll new file mode 100644 index 000000000000..98ff684d2ec6 --- /dev/null +++ b/test/CodeGen/Thumb/fastcc.ll @@ -0,0 +1,36 @@ +; RUN: llc < %s -mcpu=arm926ej-s -mattr=+vfp2 + +; This is a regression test, to ensure that fastcc functions are correctly +; handled when compiling for a processor which has a floating-point unit which +; is not accessible from the selected instruction set. + +target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "thumbv5e-none-linux-gnueabi" + +; Function Attrs: optsize +define fastcc void @_foo(float %walpha) #0 { +entry: + br label %for.body13 + +for.body13: ; preds = %for.body13, %entry + br i1 undef, label %for.end182.critedge, label %for.body13 + +for.end182.critedge: ; preds = %for.body13 + %conv183 = fpext float %walpha to double + %mul184 = fmul double %conv183, 8.200000e-01 + %conv185 = fptrunc double %mul184 to float + %conv188 = fpext float %conv185 to double + %mul189 = fmul double %conv188, 6.000000e-01 + %conv190 = fptrunc double %mul189 to float + br label %for.body193 + +for.body193: ; preds = %for.body193, %for.end182.critedge + %mul195 = fmul float %conv190, undef + br label %for.body193 +} + +attributes #0 = { optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.ident = !{!0} + +!0 = metadata !{metadata !"clang version 3.5.0 "} diff --git a/test/CodeGen/Thumb/fpconv.ll b/test/CodeGen/Thumb/fpconv.ll index 7da36ddf58ed..0ade798d1471 100644 --- a/test/CodeGen/Thumb/fpconv.ll +++ b/test/CodeGen/Thumb/fpconv.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb +; RUN: llc -mtriple=thumb-eabi %s -o /dev/null define float @f1(double %x) { entry: diff --git a/test/CodeGen/Thumb/fpow.ll b/test/CodeGen/Thumb/fpow.ll index be3dc0b3c1f8..18b1c91098f5 100644 --- a/test/CodeGen/Thumb/fpow.ll +++ b/test/CodeGen/Thumb/fpow.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb +; RUN: llc -mtriple=thumb-eabi %s -o /dev/null define double @t(double %x, double %y) nounwind optsize { entry: diff --git a/test/CodeGen/Thumb/inlineasm-imm-thumb.ll b/test/CodeGen/Thumb/inlineasm-imm-thumb.ll index 5c8a52af59e4..4e4f8fad25f8 100644 --- a/test/CodeGen/Thumb/inlineasm-imm-thumb.ll +++ b/test/CodeGen/Thumb/inlineasm-imm-thumb.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb +; RUN: llc -mtriple=thumb-eabi -no-integrated-as %s -o /dev/null ; Test Thumb-mode "I" constraint, for ADD immediate. define i32 @testI(i32 %x) { diff --git a/test/CodeGen/Thumb/inlineasm-thumb.ll b/test/CodeGen/Thumb/inlineasm-thumb.ll index f2683c8dd8cc..2547ce8d6beb 100644 --- a/test/CodeGen/Thumb/inlineasm-thumb.ll +++ b/test/CodeGen/Thumb/inlineasm-thumb.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=thumb | FileCheck %s +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s + define i32 @t1(i32 %x, i32 %y) nounwind { entry: ; CHECK: mov r0, r12 diff --git a/test/CodeGen/Thumb/ispositive.ll b/test/CodeGen/Thumb/ispositive.ll index 7b2822707745..8d396878932b 100644 --- a/test/CodeGen/Thumb/ispositive.ll +++ b/test/CodeGen/Thumb/ispositive.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb | FileCheck %s +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @test1(i32 %X) { entry: diff --git a/test/CodeGen/Thumb/ldr_ext.ll b/test/CodeGen/Thumb/ldr_ext.ll index 9a28124b84ce..2d25af35b513 100644 --- a/test/CodeGen/Thumb/ldr_ext.ll +++ b/test/CodeGen/Thumb/ldr_ext.ll @@ -1,5 +1,5 @@ -; RUN: llc < %s -march=thumb | FileCheck %s -check-prefix=V5 -; RUN: llc < %s -march=thumb -mattr=+v6 | FileCheck %s -check-prefix=V6 +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s -check-prefix=V5 +; RUN: llc -mtriple=thumb-eabi -mattr=+v6 %s -o - | FileCheck %s -check-prefix=V6 ; rdar://7176514 diff --git a/test/CodeGen/Thumb/ldr_frame.ll b/test/CodeGen/Thumb/ldr_frame.ll index 6c586385b1bc..0e879d7379a8 100644 --- a/test/CodeGen/Thumb/ldr_frame.ll +++ b/test/CodeGen/Thumb/ldr_frame.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb | FileCheck %s +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @f1() { ; CHECK-LABEL: f1: diff --git a/test/CodeGen/Thumb/lit.local.cfg b/test/CodeGen/Thumb/lit.local.cfg index 8a3ba96497e7..98c6700c209d 100644 --- a/test/CodeGen/Thumb/lit.local.cfg +++ b/test/CodeGen/Thumb/lit.local.cfg @@ -1,4 +1,3 @@ -targets = set(config.root.targets_to_build.split()) -if not 'ARM' in targets: +if not 'ARM' in config.root.targets: config.unsupported = True diff --git a/test/CodeGen/Thumb/long-setcc.ll b/test/CodeGen/Thumb/long-setcc.ll index 8f2d98fc43c9..3460edb96f0d 100644 --- a/test/CodeGen/Thumb/long-setcc.ll +++ b/test/CodeGen/Thumb/long-setcc.ll @@ -1,5 +1,4 @@ -; RUN: llc < %s -march=thumb | grep cmp | count 1 - +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i1 @t1(i64 %x) { %B = icmp slt i64 %x, 0 @@ -15,3 +14,9 @@ define i1 @t3(i32 %x) { %tmp = icmp ugt i32 %x, -1 ret i1 %tmp } + +; CHECK: cmp +; CHECK-NOT: cmp + + + diff --git a/test/CodeGen/Thumb/long.ll b/test/CodeGen/Thumb/long.ll index 197e19e31b49..2449e5ad6777 100644 --- a/test/CodeGen/Thumb/long.ll +++ b/test/CodeGen/Thumb/long.ll @@ -1,10 +1,5 @@ -; RUN: llc < %s -march=thumb | \ -; RUN: grep mvn | count 1 -; RUN: llc < %s -march=thumb | \ -; RUN: grep adc | count 1 -; RUN: llc < %s -march=thumb | \ -; RUN: grep sbc | count 1 -; RUN: llc < %s -mtriple=thumb-apple-darwin | grep __muldi3 +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s +; RUN: llc -mtriple=thumb-apple-darwin %s -o - | FileCheck %s -check-prefix CHECK-DARWIN define i64 @f1() { entry: @@ -74,3 +69,14 @@ entry: ret i64 %retval } +; CHECK: mvn +; CHECK-NOT: mvn + +; CHECK: adc +; CHECK-NOT: adc + +; CHECK: sbc +; CHECK-NOT: sbc + +; CHECK-DARWIN: __muldi3 + diff --git a/test/CodeGen/Thumb/long_shift.ll b/test/CodeGen/Thumb/long_shift.ll index 24317141fca6..6aa1afd38988 100644 --- a/test/CodeGen/Thumb/long_shift.ll +++ b/test/CodeGen/Thumb/long_shift.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb +; RUN: llc -mtriple=thumb-eabi %s -o /dev/null define i64 @f0(i64 %A, i64 %B) { %tmp = bitcast i64 %A to i64 diff --git a/test/CodeGen/Thumb/mature-mc-support.ll b/test/CodeGen/Thumb/mature-mc-support.ll new file mode 100644 index 000000000000..d7f8ae6c6c4d --- /dev/null +++ b/test/CodeGen/Thumb/mature-mc-support.ll @@ -0,0 +1,12 @@ +; Test that inline assembly is parsed by the MC layer when MC support is mature +; (even when the output is assembly). + +; RUN: not llc -mtriple=thumb-pc-linux < %s > /dev/null 2> %t1 +; RUN: FileCheck %s < %t1 + +; RUN: not llc -mtriple=thumb-pc-linux -filetype=obj < %s > /dev/null 2> %t2 +; RUN: FileCheck %s < %t2 + +module asm " .this_directive_is_very_unlikely_to_exist" + +; CHECK: LLVM ERROR: Error parsing inline asm diff --git a/test/CodeGen/Thumb/mul.ll b/test/CodeGen/Thumb/mul.ll index c1a2fb29477d..13a2cfb4c242 100644 --- a/test/CodeGen/Thumb/mul.ll +++ b/test/CodeGen/Thumb/mul.ll @@ -1,22 +1,32 @@ -; RUN: llc < %s -march=thumb | grep mul | count 3 -; RUN: llc < %s -march=thumb | grep lsl | count 1 +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @f1(i32 %u) { %tmp = mul i32 %u, %u ret i32 %tmp } +; CHECK: mul{{s?}} + define i32 @f2(i32 %u, i32 %v) { %tmp = mul i32 %u, %v ret i32 %tmp } +; CHECK: mul{{s?}} + define i32 @f3(i32 %u) { %tmp = mul i32 %u, 5 ret i32 %tmp } +; CHECK: mul{{s?}} + define i32 @f4(i32 %u) { %tmp = mul i32 %u, 4 ret i32 %tmp } + +; CHECK: lsl +; CHECK-NOT: mul{{s?}} +; CHECK-NOT: lsl + diff --git a/test/CodeGen/Thumb/rev.ll b/test/CodeGen/Thumb/rev.ll index dcba00e49663..3e947022e601 100644 --- a/test/CodeGen/Thumb/rev.ll +++ b/test/CodeGen/Thumb/rev.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb -mattr=+v6 | FileCheck %s +; RUN: llc -mtriple=thumb-eabi -mattr=+v6 %s -o - | FileCheck %s define i32 @test1(i32 %X) nounwind { ; CHECK: test1 diff --git a/test/CodeGen/Thumb/segmented-stacks-dynamic.ll b/test/CodeGen/Thumb/segmented-stacks-dynamic.ll new file mode 100644 index 000000000000..5d51f4052c1d --- /dev/null +++ b/test/CodeGen/Thumb/segmented-stacks-dynamic.ll @@ -0,0 +1,65 @@ +; RUN: llc < %s -mtriple=thumb-linux-unknown-gnueabi -verify-machineinstrs | FileCheck %s -check-prefix=Thumb-linux +; RUN: llc < %s -mtriple=thumb-linux-androideabi -verify-machineinstrs | FileCheck %s -check-prefix=Thumb-android +; RUN: llc < %s -mtriple=thumb-linux-unknown-gnueabi -filetype=obj +; RUN: llc < %s -mtriple=thumb-linux-androideabi -filetype=obj + +; Just to prevent the alloca from being optimized away +declare void @dummy_use(i32*, i32) + +define i32 @test_basic(i32 %l) #0 { + %mem = alloca i32, i32 %l + call void @dummy_use (i32* %mem, i32 %l) + %terminate = icmp eq i32 %l, 0 + br i1 %terminate, label %true, label %false + +true: + ret i32 0 + +false: + %newlen = sub i32 %l, 1 + %retvalue = call i32 @test_basic(i32 %newlen) + ret i32 %retvalue + +; Thumb-linux: test_basic: + +; Thumb-linux: push {r4, r5} +; Thumb-linux: mov r5, sp +; Thumb-linux-NEXT: ldr r4, .LCPI0_0 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB0_2 + +; Thumb-linux: mov r4, #16 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +; Thumb-android: test_basic: + +; Thumb-android: push {r4, r5} +; Thumb-android: mov r5, sp +; Thumb-android-NEXT: ldr r4, .LCPI0_0 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB0_2 + +; Thumb-android: mov r4, #16 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +} + +attributes #0 = { "split-stack" } diff --git a/test/CodeGen/Thumb/segmented-stacks.ll b/test/CodeGen/Thumb/segmented-stacks.ll new file mode 100644 index 000000000000..d6e25c7792e8 --- /dev/null +++ b/test/CodeGen/Thumb/segmented-stacks.ll @@ -0,0 +1,261 @@ +; RUN: llc < %s -mtriple=thumb-linux-androideabi -verify-machineinstrs | FileCheck %s -check-prefix=Thumb-android +; RUN: llc < %s -mtriple=thumb-linux-unknown-gnueabi -verify-machineinstrs | FileCheck %s -check-prefix=Thumb-linux +; RUN: llc < %s -mtriple=thumb-linux-androideabi -filetype=obj +; RUN: llc < %s -mtriple=thumb-linux-unknown-gnueabi -filetype=obj + + +; Just to prevent the alloca from being optimized away +declare void @dummy_use(i32*, i32) + +define void @test_basic() #0 { + %mem = alloca i32, i32 10 + call void @dummy_use (i32* %mem, i32 10) + ret void + +; Thumb-android: test_basic: + +; Thumb-android: push {r4, r5} +; Thumb-android-NEXT: mov r5, sp +; Thumb-android-NEXT: ldr r4, .LCPI0_0 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB0_2 + +; Thumb-android: mov r4, #48 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +; Thumb-linux: test_basic: + +; Thumb-linux: push {r4, r5} +; Thumb-linux-NEXT: mov r5, sp +; Thumb-linux-NEXT: ldr r4, .LCPI0_0 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB0_2 + +; Thumb-linux: mov r4, #48 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +} + +define i32 @test_nested(i32 * nest %closure, i32 %other) #0 { + %addend = load i32 * %closure + %result = add i32 %other, %addend + %mem = alloca i32, i32 10 + call void @dummy_use (i32* %mem, i32 10) + ret i32 %result + +; Thumb-android: test_nested: + +; Thumb-android: push {r4, r5} +; Thumb-android-NEXT: mov r5, sp +; Thumb-android-NEXT: ldr r4, .LCPI1_0 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB1_2 + +; Thumb-android: mov r4, #56 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +; Thumb-linux: test_nested: + +; Thumb-linux: push {r4, r5} +; Thumb-linux-NEXT: mov r5, sp +; Thumb-linux-NEXT: ldr r4, .LCPI1_0 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB1_2 + +; Thumb-linux: mov r4, #56 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +} + +define void @test_large() #0 { + %mem = alloca i32, i32 10000 + call void @dummy_use (i32* %mem, i32 0) + ret void + +; Thumb-android: test_large: + +; Thumb-android: push {r4, r5} +; Thumb-android-NEXT: mov r5, sp +; Thumb-android-NEXT: sub r5, #40192 +; Thumb-android-NEXT: ldr r4, .LCPI2_2 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB2_2 + +; Thumb-android: mov r4, #40192 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +; Thumb-linux: test_large: + +; Thumb-linux: push {r4, r5} +; Thumb-linux-NEXT: mov r5, sp +; Thumb-linux-NEXT: sub r5, #40192 +; Thumb-linux-NEXT: ldr r4, .LCPI2_2 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB2_2 + +; Thumb-linux: mov r4, #40192 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +} + +define fastcc void @test_fastcc() #0 { + %mem = alloca i32, i32 10 + call void @dummy_use (i32* %mem, i32 10) + ret void + +; Thumb-android: test_fastcc: + +; Thumb-android: push {r4, r5} +; Thumb-android-NEXT: mov r5, sp +; Thumb-android-NEXT: ldr r4, .LCPI3_0 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB3_2 + +; Thumb-android: mov r4, #48 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +; Thumb-linux: test_fastcc: + +; Thumb-linux: push {r4, r5} +; Thumb-linux-NEXT: mov r5, sp +; Thumb-linux-NEXT: ldr r4, .LCPI3_0 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB3_2 + +; Thumb-linux: mov r4, #48 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +} + +define fastcc void @test_fastcc_large() #0 { + %mem = alloca i32, i32 10000 + call void @dummy_use (i32* %mem, i32 0) + ret void + +; Thumb-android: test_fastcc_large: + +; Thumb-android: push {r4, r5} +; Thumb-android-NEXT: mov r5, sp +; Thumb-android-NEXT: sub r5, #40192 +; Thumb-android-NEXT: ldr r4, .LCPI4_2 +; Thumb-android-NEXT: ldr r4, [r4] +; Thumb-android-NEXT: cmp r4, r5 +; Thumb-android-NEXT: blo .LBB4_2 + +; Thumb-android: mov r4, #40192 +; Thumb-android-NEXT: mov r5, #0 +; Thumb-android-NEXT: push {lr} +; Thumb-android-NEXT: bl __morestack +; Thumb-android-NEXT: pop {r4} +; Thumb-android-NEXT: mov lr, r4 +; Thumb-android-NEXT: pop {r4, r5} +; Thumb-android-NEXT: bx lr + +; Thumb-android: pop {r4, r5} + +; Thumb-linux: test_fastcc_large: + +; Thumb-linux: push {r4, r5} +; Thumb-linux-NEXT: mov r5, sp +; Thumb-linux-NEXT: sub r5, #40192 +; Thumb-linux-NEXT: ldr r4, .LCPI4_2 +; Thumb-linux-NEXT: ldr r4, [r4] +; Thumb-linux-NEXT: cmp r4, r5 +; Thumb-linux-NEXT: blo .LBB4_2 + +; Thumb-linux: mov r4, #40192 +; Thumb-linux-NEXT: mov r5, #0 +; Thumb-linux-NEXT: push {lr} +; Thumb-linux-NEXT: bl __morestack +; Thumb-linux-NEXT: pop {r4} +; Thumb-linux-NEXT: mov lr, r4 +; Thumb-linux-NEXT: pop {r4, r5} +; Thumb-linux-NEXT: bx lr + +; Thumb-linux: pop {r4, r5} + +} + +define void @test_nostack() #0 { + ret void + +; Thumb-android-LABEL: test_nostack: +; Thumb-android-NOT: bl __morestack + +; Thumb-linux-LABEL: test_nostack: +; Thumb-linux-NOT: bl __morestack +} + +attributes #0 = { "split-stack" } diff --git a/test/CodeGen/Thumb/sjljehprepare-lower-vector.ll b/test/CodeGen/Thumb/sjljehprepare-lower-vector.ll new file mode 100644 index 000000000000..ab082c79ba6f --- /dev/null +++ b/test/CodeGen/Thumb/sjljehprepare-lower-vector.ll @@ -0,0 +1,23 @@ +; RUN: llc -mtriple=thumbv7-apple-ios < %s +; SjLjEHPrepare shouldn't crash when lowering vectors. + +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32" +target triple = "thumbv7-apple-ios" + +define i8* @foo(<4 x i32> %c) { +entry: + invoke void @bar () + to label %unreachable unwind label %handler + +unreachable: + unreachable + +handler: + %tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @baz to i8*) + cleanup + resume { i8*, i32 } undef +} + +declare void @bar() +declare i32 @baz(...) + diff --git a/test/CodeGen/Thumb/stack-coloring-without-frame-ptr.ll b/test/CodeGen/Thumb/stack-coloring-without-frame-ptr.ll index 3f6407a0a3c0..97c66d9dc865 100644 --- a/test/CodeGen/Thumb/stack-coloring-without-frame-ptr.ll +++ b/test/CodeGen/Thumb/stack-coloring-without-frame-ptr.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb -mcpu=arm1022e +; RUN: llc -mtriple=thumb-eabi -mcpu=arm1022e %s -o /dev/null %iterator = type { i8**, i8**, i8**, i8*** } %insert_iterator = type { %deque*, %iterator } diff --git a/test/CodeGen/Thumb/stack-frame.ll b/test/CodeGen/Thumb/stack-frame.ll index b103b331b797..09d480aec290 100644 --- a/test/CodeGen/Thumb/stack-frame.ll +++ b/test/CodeGen/Thumb/stack-frame.ll @@ -1,5 +1,4 @@ -; RUN: llc < %s -march=thumb -; RUN: llc < %s -march=thumb | grep add | count 1 +; RUN: llc -mtriple=thumb-eabi < %s -o - | FileCheck %s define void @f1() { %c = alloca i8, align 1 @@ -10,4 +9,6 @@ define i32 @f2() { ret i32 1 } +; CHECK: add +; CHECK-NOT: add diff --git a/test/CodeGen/Thumb/thumb-imm.ll b/test/CodeGen/Thumb/thumb-imm.ll index 74a57ff271be..592e694e0277 100644 --- a/test/CodeGen/Thumb/thumb-imm.ll +++ b/test/CodeGen/Thumb/thumb-imm.ll @@ -1,5 +1,4 @@ -; RUN: llc < %s -march=thumb | not grep CPI - +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @test1() { ret i32 1000 @@ -8,3 +7,6 @@ define i32 @test1() { define i32 @test2() { ret i32 -256 } + +; CHECK-NOT: CPI + diff --git a/test/CodeGen/Thumb/thumb-ldm.ll b/test/CodeGen/Thumb/thumb-ldm.ll new file mode 100644 index 000000000000..95f3edc9c4c3 --- /dev/null +++ b/test/CodeGen/Thumb/thumb-ldm.ll @@ -0,0 +1,43 @@ +; RUN: llc < %s -mtriple=thumbv6m-eabi -o - | FileCheck %s +; XFAIL: * + +@X = external global [0 x i32] ; <[0 x i32]*> [#uses=5] + +define i32 @t1() { +; CHECK-LABEL: t1: +; CHECK: push {r7, lr} +; CHECK: ldm +; CHECK: pop {r7, pc} + %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 0) ; <i32> [#uses=1] + %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1] + %tmp4 = call i32 @f1( i32 %tmp, i32 %tmp3 ) ; <i32> [#uses=1] + ret i32 %tmp4 +} + +define i32 @t2() { +; CHECK-LABEL: t2: +; CHECK: push {r7, lr} +; CHECK: ldm +; CHECK: pop {r7, pc} + %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1] + %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1] + %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 4) ; <i32> [#uses=1] + %tmp6 = call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; <i32> [#uses=1] + ret i32 %tmp6 +} + +define i32 @t3() { +; CHECK-LABEL: t3: +; CHECK: push {r7, lr} +; CHECK: ldm +; CHECK: pop {r7, pc} + %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1] + %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1] + %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1] + %tmp6 = call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; <i32> [#uses=1] + ret i32 %tmp6 +} + +declare i32 @f1(i32, i32) + +declare i32 @f2(i32, i32, i32) diff --git a/test/CodeGen/Thumb/thumb-memcpy-ldm-stm.ll b/test/CodeGen/Thumb/thumb-memcpy-ldm-stm.ll new file mode 100644 index 000000000000..dedc82bf68ce --- /dev/null +++ b/test/CodeGen/Thumb/thumb-memcpy-ldm-stm.ll @@ -0,0 +1,38 @@ +; RUN: llc -mtriple=thumbv6m-eabi %s -o - | FileCheck %s +; XFAIL: * + +@d = external global [64 x i32] +@s = external global [64 x i32] + +; Function Attrs: nounwind +define void @t1() #0 { +entry: +; CHECK: ldr [[REG0:r[0-9]]], +; CHECK: ldm [[REG0]]!, +; CHECK: ldr [[REG1:r[0-9]]], +; CHECK: stm [[REG1]]!, +; CHECK: subs [[REG0]], #32 +; CHECK-NEXT: ldrb +; CHECK: subs [[REG1]], #32 +; CHECK-NEXT: strb + tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([64 x i32]* @s to i8*), i8* bitcast ([64 x i32]* @d to i8*), i32 33, i32 4, i1 false) + ret void +} + +; Function Attrs: nounwind +define void @t2() #0 { +entry: +; CHECK: ldr [[REG0:r[0-9]]], +; CHECK: ldm [[REG0]]!, +; CHECK: ldr [[REG1:r[0-9]]], +; CHECK: stm [[REG1]]!, +; CHECK: ldrh +; CHECK: ldrb +; CHECK: strb +; CHECK: strh + tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([64 x i32]* @s to i8*), i8* bitcast ([64 x i32]* @d to i8*), i32 15, i32 4, i1 false) + ret void +} + +; Function Attrs: nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) #1 diff --git a/test/CodeGen/Thumb/trap.ll b/test/CodeGen/Thumb/trap.ll index e04059c4b021..7d2f6f11a4d1 100644 --- a/test/CodeGen/Thumb/trap.ll +++ b/test/CodeGen/Thumb/trap.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb | FileCheck %s +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s ; rdar://7961298 define void @t() nounwind { diff --git a/test/CodeGen/Thumb/triple.ll b/test/CodeGen/Thumb/triple.ll new file mode 100644 index 000000000000..0a1759f081ba --- /dev/null +++ b/test/CodeGen/Thumb/triple.ll @@ -0,0 +1,7 @@ +; RUN: llc < %s -mtriple=thumb | FileCheck %s + +; CHECK: .code 16 + +define void @f() { + ret void +} diff --git a/test/CodeGen/Thumb/tst_teq.ll b/test/CodeGen/Thumb/tst_teq.ll index 21ada3ed83a0..2b6d9a3706a3 100644 --- a/test/CodeGen/Thumb/tst_teq.ll +++ b/test/CodeGen/Thumb/tst_teq.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=thumb | grep tst +; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s define i32 @f(i32 %a) { entry: @@ -15,3 +15,6 @@ entry: %retval = select i1 %0, i32 20, i32 10 ; <i32> [#uses=1] ret i32 %retval } + +; CHECK: tst + diff --git a/test/CodeGen/Thumb/unord.ll b/test/CodeGen/Thumb/unord.ll index 39458ae7b7bc..3cf9ebfa0373 100644 --- a/test/CodeGen/Thumb/unord.ll +++ b/test/CodeGen/Thumb/unord.ll @@ -1,13 +1,20 @@ -; RUN: llc < %s -march=thumb | grep bne | count 1 -; RUN: llc < %s -march=thumb | grep beq | count 1 +; RUN: llc < %s -mtriple=thumb-apple-darwin | FileCheck %s define i32 @f1(float %X, float %Y) { +; CHECK-LABEL: _f1: +; CHECK: bne +; CHECK: .data_region +; CHECK: .long ___unordsf2 %tmp = fcmp uno float %X, %Y %retval = select i1 %tmp, i32 1, i32 -1 ret i32 %retval } define i32 @f2(float %X, float %Y) { +; CHECK-LABEL: _f2: +; CHECK: beq +; CHECK: .data_region +; CHECK: .long ___unordsf2 %tmp = fcmp ord float %X, %Y %retval = select i1 %tmp, i32 1, i32 -1 ret i32 %retval diff --git a/test/CodeGen/Thumb/vargs.ll b/test/CodeGen/Thumb/vargs.ll index 50a1a0728846..4078b01ba30c 100644 --- a/test/CodeGen/Thumb/vargs.ll +++ b/test/CodeGen/Thumb/vargs.ll @@ -1,6 +1,6 @@ -; RUN: llc < %s -march=thumb -; RUN: llc < %s -mtriple=thumb-linux | grep pop | count 2 -; RUN: llc < %s -mtriple=thumb-darwin | grep pop | count 2 +; RUN: llc -mtriple=thumb-eabi %s -o /dev/null +; RUN: llc -mtriple=thumb-linux %s -o - | FileCheck %s +; RUN: llc -mtriple=thumb-darwin %s -o - | FileCheck %s @str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] @@ -34,3 +34,8 @@ declare void @llvm.va_start(i8*) declare i32 @printf(i8*, ...) declare void @llvm.va_end(i8*) + +; CHECK: pop +; CHECK: pop +; CHECK-NOT: pop + |