• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s --check-prefix=CHECK --check-prefix=T2
2; RUN: llc < %s -mtriple=thumbv6m-apple-darwin -relocation-model=pic | FileCheck %s --check-prefix=CHECK --check-prefix=T1
3; RUN: llc < %s -mtriple=thumbv6m-apple-darwin -relocation-model=static | FileCheck %s --check-prefix=CHECK --check-prefix=T1
4
5; Thumb2 target should reorder the bb's in order to use tbb / tbh.
6
7	%struct.R_flstr = type { i32, i32, i8* }
8	%struct._T_tstr = type { i32, %struct.R_flstr*, %struct._T_tstr* }
9@_C_nextcmd = external global i32		; <i32*> [#uses=3]
10@.str31 = external constant [28 x i8], align 1		; <[28 x i8]*> [#uses=1]
11@_T_gtol = external global %struct._T_tstr*		; <%struct._T_tstr**> [#uses=2]
12
13declare i32 @strlen(i8* nocapture) nounwind readonly
14
15declare void @Z_fatal(i8*) noreturn nounwind
16
17declare noalias i8* @calloc(i32, i32) nounwind
18
19; Jump tables are not anchored next to the TBB/TBH any more. Make sure the
20; correct address is still calculated (i.e. via a PC-relative symbol *at* the
21; TBB/TBH).
22define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
23; CHECK-LABEL: main:
24; CHECK-NOT: adr {{r[0-9]+}}, LJTI
25; T1:          lsls r[[x:[0-9]+]], {{r[0-9]+}}, #1
26; CHECK: [[PCREL_ANCHOR:LCPI[0-9]+_[0-9]+]]:
27; T2-NEXT:     tbb [pc, {{r[0-9]+}}]
28; T1-NEXT:     add  pc, r[[x]]
29
30; CHECK: LJTI0_0:
31; CHECK-NEXT: .data_region jt8
32; CHECK-NEXT: .byte (LBB{{[0-9]+_[0-9]+}}-([[PCREL_ANCHOR]]+4))/2
33
34entry:
35	br label %bb42.i
36
37bb1.i2:		; preds = %bb42.i
38	br label %bb40.i
39
40bb5.i:		; preds = %bb42.i
41	%0 = or i32 %argc, 32		; <i32> [#uses=1]
42	br label %bb40.i
43
44bb7.i:		; preds = %bb42.i
45	call  void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 0, i8* null) nounwind
46	unreachable
47
48bb15.i:		; preds = %bb42.i
49	call  void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 2, i8* null) nounwind
50	unreachable
51
52bb23.i:		; preds = %bb42.i
53	%1 = call  i32 @strlen(i8* null) nounwind readonly		; <i32> [#uses=0]
54	unreachable
55
56bb33.i:		; preds = %bb42.i
57	store i32 0, i32* @_C_nextcmd, align 4
58	%2 = call  noalias i8* @calloc(i32 21, i32 1) nounwind		; <i8*> [#uses=0]
59	unreachable
60
61bb34.i:		; preds = %bb42.i
62	%3 = load i32, i32* @_C_nextcmd, align 4		; <i32> [#uses=1]
63	%4 = add i32 %3, 1		; <i32> [#uses=1]
64	store i32 %4, i32* @_C_nextcmd, align 4
65	%5 = call  noalias i8* @calloc(i32 22, i32 1) nounwind		; <i8*> [#uses=0]
66	unreachable
67
68bb35.i:		; preds = %bb42.i
69	%6 = call  noalias i8* @calloc(i32 20, i32 1) nounwind		; <i8*> [#uses=0]
70	unreachable
71
72bb37.i:		; preds = %bb42.i
73	%7 = call  noalias i8* @calloc(i32 14, i32 1) nounwind		; <i8*> [#uses=0]
74	unreachable
75
76bb39.i:		; preds = %bb42.i
77	call  void @Z_fatal(i8* getelementptr ([28 x i8], [28 x i8]* @.str31, i32 0, i32 0)) nounwind
78	unreachable
79
80bb40.i:		; preds = %bb42.i, %bb5.i, %bb1.i2
81	br label %bb42.i
82
83bb42.i:		; preds = %bb40.i, %entry
84	switch i32 %argc, label %bb39.i [
85		i32 67, label %bb33.i
86		i32 70, label %bb35.i
87		i32 77, label %bb37.i
88		i32 83, label %bb34.i
89		i32 97, label %bb7.i
90		i32 100, label %bb5.i
91		i32 101, label %bb40.i
92		i32 102, label %bb23.i
93		i32 105, label %bb15.i
94		i32 116, label %bb1.i2
95	]
96}
97
98declare void @_T_addtol(%struct._T_tstr** nocapture, i32, i8*) nounwind
99