blob: ab2c579e514eae8a18444fdecd667390974ebcae [file] [log] [blame]
Florian Hahn08fdd042017-06-29 08:45:31 +00001; RUN: llc -mtriple=thumbv7m-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s --check-prefix=T2
2; RUN: llc -mtriple=thumbv6m-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s --check-prefix=T1
James Molloy70a3d6d2016-11-01 13:37:41 +00003
4declare void @foo(double)
5declare i32 @llvm.arm.space(i32, i32)
6
7define i32 @test_tbh(i1 %tst, i32 %sw, i32 %l) {
8 br label %complex
9
10; T2-LABEL: test_tbh:
11; T2: [[ANCHOR:.LCPI[0-9_]+]]:
12; T2: tbh [pc, r{{[0-9]+}}, lsl #1]
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000013; T2-NEXT: @ %bb.{{[0-9]+}}
James Molloy70a3d6d2016-11-01 13:37:41 +000014; T2-NEXT: LJTI
15; T2-NEXT: .short (.LBB0_[[x:[0-9]+]]-([[ANCHOR]]+4))/2
16; T2-NEXT: .short (.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
17; T2-NEXT: .short (.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
18; T2-NEXT: .short (.LBB0_[[x]]-([[ANCHOR]]+4))/2
19
20; T1-LABEL: test_tbh:
21; T1: lsls [[x:r[0-9]+]], r4, #1
22; T1: add [[x]], pc
23; T1: ldrh [[x]], {{\[}}[[x]], #4]
24; T1: lsls [[x]], [[x]], #1
25; T1: [[ANCHOR:.LCPI[0-9_]+]]:
26; T1: add pc, [[x]]
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000027; T1-NEXT: @ %bb.2
James Molloy70a3d6d2016-11-01 13:37:41 +000028; T1-NEXT: .p2align 2
29; T1-NEXT: LJTI
30; T1-NEXT: .short (.LBB0_[[x:[0-9]+]]-([[ANCHOR]]+4))/2
31; T1-NEXT: .short (.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
32; T1-NEXT: .short (.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
33; T1-NEXT: .short (.LBB0_[[x]]-([[ANCHOR]]+4))/2
34
35complex:
36 call void @foo(double 12345.0)
37 switch i32 %sw, label %second [ i32 0, label %other
38 i32 1, label %third
39 i32 2, label %end
40 i32 3, label %other ]
41
42second:
43 ret i32 43
44third:
45 call i32 @llvm.arm.space(i32 970, i32 undef)
46 ret i32 0
47
48other:
49 call void @bar()
50 unreachable
51
52end:
53 ret i32 42
54}
55
56declare void @bar()