summaryrefslogtreecommitdiff
path: root/test/CodeGen/Thumb2
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /test/CodeGen/Thumb2
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Notes
Diffstat (limited to 'test/CodeGen/Thumb2')
-rw-r--r--test/CodeGen/Thumb2/2009-09-01-PostRAProlog.ll2
-rw-r--r--test/CodeGen/Thumb2/2009-12-01-LoopIVUsers.ll1
-rw-r--r--test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll4
-rw-r--r--test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll2
-rw-r--r--test/CodeGen/Thumb2/aligned-constants.ll4
-rw-r--r--test/CodeGen/Thumb2/bicbfi.ll17
-rw-r--r--test/CodeGen/Thumb2/carry.ll8
-rw-r--r--test/CodeGen/Thumb2/emit-unwinding.ll2
-rw-r--r--test/CodeGen/Thumb2/ldr-str-imm12.ll20
-rw-r--r--test/CodeGen/Thumb2/thumb2-call.ll18
-rw-r--r--test/CodeGen/Thumb2/thumb2-cbnz.ll4
-rw-r--r--test/CodeGen/Thumb2/thumb2-cpsr-liveness.ll41
-rw-r--r--test/CodeGen/Thumb2/thumb2-ldm.ll55
-rw-r--r--test/CodeGen/Thumb2/thumb2-tbb.ll2
-rw-r--r--test/CodeGen/Thumb2/tls2.ll4
-rw-r--r--test/CodeGen/Thumb2/v8_IT_5.ll25
16 files changed, 137 insertions, 72 deletions
diff --git a/test/CodeGen/Thumb2/2009-09-01-PostRAProlog.ll b/test/CodeGen/Thumb2/2009-09-01-PostRAProlog.ll
index 84f69f4b6e0b..5b7107604e6f 100644
--- a/test/CodeGen/Thumb2/2009-09-01-PostRAProlog.ll
+++ b/test/CodeGen/Thumb2/2009-09-01-PostRAProlog.ll
@@ -102,5 +102,3 @@ bb7: ; preds = %bb5
}
declare noalias i8* @calloc(i32, i32) nounwind
-
-declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
diff --git a/test/CodeGen/Thumb2/2009-12-01-LoopIVUsers.ll b/test/CodeGen/Thumb2/2009-12-01-LoopIVUsers.ll
index e59e84d49ecf..b4248b81748d 100644
--- a/test/CodeGen/Thumb2/2009-12-01-LoopIVUsers.ll
+++ b/test/CodeGen/Thumb2/2009-12-01-LoopIVUsers.ll
@@ -8,7 +8,6 @@ entry:
; -- The loop following the load should only use a single add-literation
; instruction.
; CHECK: vldr
-; CHECK: adds r{{[0-9]+.*}}#1
; CHECK-NOT: adds
; CHECK: subsections_via_symbols
diff --git a/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll b/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
index c662620b19e2..fff83c546678 100644
--- a/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
+++ b/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
@@ -31,9 +31,9 @@ return: ; preds = %bb, %entry
define i32 @test_dead_cycle(i32 %n) nounwind {
; CHECK-LABEL: test_dead_cycle:
-; CHECK: blx
+; CHECK: bl
; CHECK-NOT: mov
-; CHECK: blx
+; CHECK: bl
entry:
%0 = icmp eq i32 %n, 1 ; <i1> [#uses=1]
br i1 %0, label %return, label %bb.nph
diff --git a/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll b/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll
index d3a44957a2eb..d02947fc3b1c 100644
--- a/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll
+++ b/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll
@@ -14,7 +14,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
%s5 = type { i32 }
; Make sure the cmp is not scheduled before the InlineAsm that clobbers cc.
-; CHECK: blx _f2
+; CHECK: bl _f2
; CHECK: cmp r0, #0
; CHECK-NOT: cmp
; CHECK: InlineAsm Start
diff --git a/test/CodeGen/Thumb2/aligned-constants.ll b/test/CodeGen/Thumb2/aligned-constants.ll
index 13cca113452c..df3b19dbb5cf 100644
--- a/test/CodeGen/Thumb2/aligned-constants.ll
+++ b/test/CodeGen/Thumb2/aligned-constants.ll
@@ -4,11 +4,11 @@ target triple = "thumbv7-apple-ios"
; The double in the constant pool is 8-byte aligned, forcing the function
; alignment.
-; CHECK: .align 3
+; CHECK: .p2align 3
; CHECK: func
;
; Constant pool with 8-byte entry before 4-byte entry:
-; CHECK: .align 3
+; CHECK: .p2align 3
; CHECK: LCPI
; CHECK: .long 2370821947
; CHECK: .long 1080815255
diff --git a/test/CodeGen/Thumb2/bicbfi.ll b/test/CodeGen/Thumb2/bicbfi.ll
new file mode 100644
index 000000000000..fcdb1225db5d
--- /dev/null
+++ b/test/CodeGen/Thumb2/bicbfi.ll
@@ -0,0 +1,17 @@
+; RUN: llc < %s | FileCheck %s
+
+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 = "thumbv7--linux-gnueabihf"
+
+; CHECK-LABEL: f:
+; CHECK: bic
+define void @f(i32* nocapture %b, i32* nocapture %c, i32 %a) {
+ %1 = and i32 %a, -4096
+ store i32 %1, i32* %c, align 4
+ %2 = and i32 %a, 4095
+ %3 = or i32 %2, 4096
+ %4 = load i32, i32* %b, align 4
+ %5 = add nsw i32 %4, %3
+ store i32 %5, i32* %b, align 4
+ ret void
+} \ No newline at end of file
diff --git a/test/CodeGen/Thumb2/carry.ll b/test/CodeGen/Thumb2/carry.ll
index 26622e23dd44..1e2b332be982 100644
--- a/test/CodeGen/Thumb2/carry.ll
+++ b/test/CodeGen/Thumb2/carry.ll
@@ -12,10 +12,10 @@ entry:
define i64 @f2(i64 %a, i64 %b) {
entry:
; CHECK-LABEL: f2:
-; CHECK: adds r0, r0, r0
-; CHECK: adcs r1, r1
-; CHECK: subs r0, r0, r2
-; CHECK: sbcs r1, r3
+; CHECK: lsls r1, r1, #1
+; CHECK: orr.w r1, r1, r0, lsr #31
+; CHECK: rsbs r0, r2, r0, lsl #1
+; CHECK: sbcs r1, r3
%tmp1 = shl i64 %a, 1
%tmp2 = sub i64 %tmp1, %b
ret i64 %tmp2
diff --git a/test/CodeGen/Thumb2/emit-unwinding.ll b/test/CodeGen/Thumb2/emit-unwinding.ll
index 1f1ea1b48af0..b77bb9e6b13c 100644
--- a/test/CodeGen/Thumb2/emit-unwinding.ll
+++ b/test/CodeGen/Thumb2/emit-unwinding.ll
@@ -1,6 +1,6 @@
; RUN: llc -mtriple thumbv7em-apple-unknown-eabi-macho %s -o - -O0 | FileCheck %s
-; CHECK: add.w r11, sp, #{{[1-9]+}}
+; CHECK: add r7, sp, #{{[1-9]+}}
define void @foo1() {
call void asm sideeffect "", "~{r4}"()
diff --git a/test/CodeGen/Thumb2/ldr-str-imm12.ll b/test/CodeGen/Thumb2/ldr-str-imm12.ll
index d20eef0c8bb7..3e4bd02097ad 100644
--- a/test/CodeGen/Thumb2/ldr-str-imm12.ll
+++ b/test/CodeGen/Thumb2/ldr-str-imm12.ll
@@ -29,16 +29,16 @@ entry:
bb20: ; preds = %entry
switch i32 undef, label %bb1287 [
- i32 11, label %bb119
- i32 12, label %bb119
- i32 21, label %bb420
- i32 23, label %bb420
- i32 45, label %bb438
- i32 46, label %bb438
- i32 55, label %bb533
- i32 56, label %bb569
- i32 64, label %bb745
- i32 78, label %bb1098
+ i32 110, label %bb119
+ i32 120, label %bb119
+ i32 210, label %bb420
+ i32 230, label %bb420
+ i32 450, label %bb438
+ i32 460, label %bb438
+ i32 550, label %bb533
+ i32 560, label %bb569
+ i32 640, label %bb745
+ i32 780, label %bb1098
]
bb119: ; preds = %bb20, %bb20
diff --git a/test/CodeGen/Thumb2/thumb2-call.ll b/test/CodeGen/Thumb2/thumb2-call.ll
index 62b47a44b494..e06df642a93a 100644
--- a/test/CodeGen/Thumb2/thumb2-call.ll
+++ b/test/CodeGen/Thumb2/thumb2-call.ll
@@ -1,26 +1,20 @@
-; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 | FileCheck %s -check-prefix=DARWIN
-; RUN: llc < %s -mtriple=thumbv7-linux -mattr=+thumb2 | FileCheck %s -check-prefix=LINUX
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 | FileCheck %s
+; RUN: llc < %s -mtriple=thumbv7-linux -mattr=+thumb2 | FileCheck %s
@t = weak global i32 ()* null ; <i32 ()**> [#uses=1]
declare void @g(i32, i32, i32, i32)
define void @f() {
-; DARWIN-LABEL: f:
-; DARWIN: blx _g
-
-; LINUX-LABEL: f:
-; LINUX: bl g
+; CHECK-LABEL: f:
+; CHECK: bl {{_?}}g
call void @g( i32 1, i32 2, i32 3, i32 4 )
ret void
}
define void @h() {
-; DARWIN-LABEL: h:
-; DARWIN: blx r0
-
-; LINUX-LABEL: h:
-; LINUX: blx r0
+; CHECK-LABEL: h:
+; CHECK: blx r0
%tmp = load i32 ()*, i32 ()** @t ; <i32 ()*> [#uses=1]
%tmp.upgrd.2 = call i32 %tmp( ) ; <i32> [#uses=0]
ret void
diff --git a/test/CodeGen/Thumb2/thumb2-cbnz.ll b/test/CodeGen/Thumb2/thumb2-cbnz.ll
index 8104dc714da0..c1a53825e3b1 100644
--- a/test/CodeGen/Thumb2/thumb2-cbnz.ll
+++ b/test/CodeGen/Thumb2/thumb2-cbnz.ll
@@ -5,6 +5,7 @@ declare double @foo(double) nounwind readnone
define void @t(i32 %c, double %b) {
entry:
+; CHECK: cmp r0, #0
%cmp1 = icmp ne i32 %c, 0
br i1 %cmp1, label %bb3, label %bb1
@@ -23,8 +24,7 @@ bb7: ; preds = %bb3
br i1 %cmp3, label %bb11, label %bb9
bb9: ; preds = %bb7
-; CHECK: cmp r0, #0
-; CHECK-NEXT: cbnz
+; CHECK: cbnz
%0 = tail call double @foo(double %b) nounwind readnone ; <double> [#uses=0]
br label %bb11
diff --git a/test/CodeGen/Thumb2/thumb2-cpsr-liveness.ll b/test/CodeGen/Thumb2/thumb2-cpsr-liveness.ll
new file mode 100644
index 000000000000..798785988938
--- /dev/null
+++ b/test/CodeGen/Thumb2/thumb2-cpsr-liveness.ll
@@ -0,0 +1,41 @@
+; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -misched-postra=true
+
+define i32 @test_cpsr() {
+entry:
+ %a = alloca [10 x i32], align 4
+ %0 = bitcast [10 x i32]* %a to i8*
+ %arrayidx.gep = getelementptr [10 x i32], [10 x i32]* %a, i32 0, i32 0
+ br label %for.body
+
+for.cond.cleanup:
+ %c.1.reg2mem.0.lcssa = phi i32 [ %c.1.reg2mem.0, %for.inc ]
+ ret i32 %c.1.reg2mem.0.lcssa
+
+for.body:
+ %1 = phi i32 [ 0, %entry ], [ %.pre, %for.inc.for.body_crit_edge ]
+ %c.018.reg2mem.0 = phi i32 [ 0, %entry ], [ %c.1.reg2mem.0, %for.inc.for.body_crit_edge ]
+ %b.017.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %b.1.reg2mem.0, %for.inc.for.body_crit_edge ]
+ %arrayidx.phi = phi i32* [ %arrayidx.gep, %entry ], [ %arrayidx.inc, %for.inc.for.body_crit_edge ]
+ %i.019 = phi i32 [ 0, %entry ], [ %inc, %for.inc.for.body_crit_edge ]
+ %cmp1 = icmp slt i32 %1, 10
+ %arrayidx.inc = getelementptr i32, i32* %arrayidx.phi, i32 1
+ br i1 %cmp1, label %for.inc, label %if.end
+
+if.end:
+ %conv = sitofp i32 %i.019 to double
+ %cmp2 = fcmp nsz ogt double %conv, %b.017.reg2mem.0
+ %selv = select i1 %cmp2, double %conv, double %b.017.reg2mem.0
+ %selv7 = select i1 %cmp2, i32 %i.019, i32 %c.018.reg2mem.0
+ br label %for.inc
+
+for.inc:
+ %b.1.reg2mem.0 = phi double [ %b.017.reg2mem.0, %for.body ], [ %selv, %if.end ]
+ %c.1.reg2mem.0 = phi i32 [ %c.018.reg2mem.0, %for.body ], [ %selv7, %if.end ]
+ %exitcond = icmp eq i32 %i.019, 9
+ br i1 %exitcond, label %for.cond.cleanup, label %for.inc.for.body_crit_edge
+
+for.inc.for.body_crit_edge:
+ %inc = add nuw nsw i32 %i.019, 1
+ %.pre = load i32, i32* %arrayidx.inc, align 4
+ br label %for.body
+}
diff --git a/test/CodeGen/Thumb2/thumb2-ldm.ll b/test/CodeGen/Thumb2/thumb2-ldm.ll
index 28903aca3267..e733d5c99262 100644
--- a/test/CodeGen/Thumb2/thumb2-ldm.ll
+++ b/test/CodeGen/Thumb2/thumb2-ldm.ll
@@ -1,12 +1,15 @@
-; RUN: llc < %s -mtriple=thumbv7-apple-ios -mattr=+thumb2 | FileCheck %s
+; RUN: llc < %s -mtriple=thumbv7-apple-ios -mattr=+thumb2 | FileCheck %s -check-prefix=ALL -check-prefix=CHECK
+; RUN: llc < %s -mtriple=thumbv7-apple-ios -mattr=+thumb2 -arm-assume-misaligned-load-store | FileCheck %s -check-prefix=ALL -check-prefix=CONSERVATIVE
@X = external global [0 x i32] ; <[0 x i32]*> [#uses=5]
define i32 @t1() {
-; CHECK-LABEL: t1:
-; CHECK: push {r7, lr}
+; ALL-LABEL: t1:
+; ALL: push {r7, lr}
; CHECK: ldrd
-; CHECK: pop {r7, pc}
+; CONSERVATIVE-NOT: ldrd
+; CONSERVATIVE-NOT: ldm
+; ALL: pop {r7, pc}
%tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 0) ; <i32> [#uses=1]
%tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1]
%tmp4 = call i32 @f1( i32 %tmp, i32 %tmp3 ) ; <i32> [#uses=1]
@@ -14,10 +17,12 @@ define i32 @t1() {
}
define i32 @t2() {
-; CHECK-LABEL: t2:
-; CHECK: push {r7, lr}
+; ALL-LABEL: t2:
+; ALL: push {r7, lr}
; CHECK: ldm
-; CHECK: pop {r7, pc}
+; CONSERVATIVE-NOT: ldrd
+; CONSERVATIVE-NOT: ldm
+; ALL: pop {r7, pc}
%tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1]
%tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1]
%tmp5 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 4) ; <i32> [#uses=1]
@@ -26,10 +31,12 @@ define i32 @t2() {
}
define i32 @t3() {
-; CHECK-LABEL: t3:
-; CHECK: push {r7, lr}
+; ALL-LABEL: t3:
+; ALL: push {r7, lr}
; CHECK: ldm
-; CHECK: pop {r7, pc}
+; CONSERVATIVE-NOT: ldrd
+; CONSERVATIVE-NOT: ldm
+; ALL: pop {r7, pc}
%tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1]
%tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1]
%tmp5 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1]
@@ -37,6 +44,34 @@ define i32 @t3() {
ret i32 %tmp6
}
+@g = common global i32* null
+
+define void @t4(i32 %a0, i32 %a1, i32 %a2) {
+; ALL-LABEL: t4:
+; ALL: stm.w sp, {r0, r1, r2}
+; ALL: bl _ext
+; ALL: ldm.w sp, {r0, r1, r2}
+; ALL: bl _f2
+ %arr = alloca [4 x i32], align 4
+ %p0 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 0
+ %p1 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 1
+ %p2 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 2
+ store i32* %p0, i32** @g, align 8
+
+ store i32 %a0, i32* %p0, align 4
+ store i32 %a1, i32* %p1, align 4
+ store i32 %a2, i32* %p2, align 4
+ call void @ext()
+
+ %v0 = load i32, i32* %p0, align 4
+ %v1 = load i32, i32* %p1, align 4
+ %v2 = load i32, i32* %p2, align 4
+ call i32 @f2(i32 %v0, i32 %v1, i32 %v2)
+ ret void
+}
+
declare i32 @f1(i32, i32)
declare i32 @f2(i32, i32, i32)
+
+declare void @ext()
diff --git a/test/CodeGen/Thumb2/thumb2-tbb.ll b/test/CodeGen/Thumb2/thumb2-tbb.ll
index 758f792695fd..9e6285199135 100644
--- a/test/CodeGen/Thumb2/thumb2-tbb.ll
+++ b/test/CodeGen/Thumb2/thumb2-tbb.ll
@@ -7,7 +7,7 @@ entry:
; CHECK: tbb
; CHECK: .data_region jt8
; CHECK: .end_data_region
-; CHECK-NEXT: .align 1
+; CHECK-NEXT: .p2align 1
switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ]
bb:
diff --git a/test/CodeGen/Thumb2/tls2.ll b/test/CodeGen/Thumb2/tls2.ll
index 8f05ceab19fc..98ae8e6d90d9 100644
--- a/test/CodeGen/Thumb2/tls2.ll
+++ b/test/CodeGen/Thumb2/tls2.ll
@@ -11,7 +11,7 @@ entry:
; CHECK-NOT-PIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: f:
-; CHECK-PIC: bl __tls_get_addr(PLT)
+; CHECK-PIC: bl __tls_get_addr
%tmp1 = load i32, i32* @i ; <i32> [#uses=1]
ret i32 %tmp1
}
@@ -24,6 +24,6 @@ entry:
; CHECK-NOT-PIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: g:
-; CHECK-PIC: bl __tls_get_addr(PLT)
+; CHECK-PIC: bl __tls_get_addr
ret i32* @i
}
diff --git a/test/CodeGen/Thumb2/v8_IT_5.ll b/test/CodeGen/Thumb2/v8_IT_5.ll
index 6a7a7a0b0aa0..d8d60413cb0e 100644
--- a/test/CodeGen/Thumb2/v8_IT_5.ll
+++ b/test/CodeGen/Thumb2/v8_IT_5.ll
@@ -17,31 +17,13 @@
define i32 @t(i32 %type) optsize {
entry:
- br i1 undef, label %if.then, label %if.else
-
-if.then:
- unreachable
-
-if.else:
- br i1 undef, label %if.then15, label %if.else18
-
-if.then15:
- unreachable
-
-if.else18:
switch i32 %type, label %if.else173 [
- i32 3, label %if.then115
- i32 1, label %if.then102
+ i32 13, label %if.then115
+ i32 6, label %if.then102
]
if.then102:
- br i1 undef, label %cond.true10.i, label %t.exit
-
-cond.true10.i:
- br label %t.exit
-
-t.exit:
- unreachable
+ br label %if.then115
if.then115:
br i1 undef, label %if.else163, label %if.else145
@@ -62,4 +44,3 @@ if.else173:
}
declare hidden fastcc %struct.hc* @foo(%struct.hc* nocapture, i32) nounwind optsize
-