Eliminate more uses of llvm-as and llvm-dis.
[oota-llvm.git] / test / CodeGen / Thumb2 / thumb2-tbh.ll
1 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s
2
3 ; Thumb2 target should reorder the bb's in order to use tbb / tbh.
4
5 ; XFAIL: *
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
13 declare arm_apcscc i32 @strlen(i8* nocapture) nounwind readonly
14
15 declare arm_apcscc void @Z_fatal(i8*) noreturn nounwind
16
17 declare arm_apcscc noalias i8* @calloc(i32, i32) nounwind
18
19 define arm_apcscc i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
20 ; CHECK: main:
21 ; CHECK: tbh
22 entry:
23         br label %bb42.i
24
25 bb1.i2:         ; preds = %bb42.i
26         br label %bb40.i
27
28 bb5.i:          ; preds = %bb42.i
29         %0 = or i32 %_Y_flags.1, 32             ; <i32> [#uses=1]
30         br label %bb40.i
31
32 bb7.i:          ; preds = %bb42.i
33         call arm_apcscc  void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 0, i8* null) nounwind
34         unreachable
35
36 bb15.i:         ; preds = %bb42.i
37         call arm_apcscc  void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 2, i8* null) nounwind
38         unreachable
39
40 bb23.i:         ; preds = %bb42.i
41         %1 = call arm_apcscc  i32 @strlen(i8* null) nounwind readonly           ; <i32> [#uses=0]
42         unreachable
43
44 bb33.i:         ; preds = %bb42.i
45         store i32 0, i32* @_C_nextcmd, align 4
46         %2 = call arm_apcscc  noalias i8* @calloc(i32 21, i32 1) nounwind               ; <i8*> [#uses=0]
47         unreachable
48
49 bb34.i:         ; preds = %bb42.i
50         %3 = load i32* @_C_nextcmd, align 4             ; <i32> [#uses=1]
51         %4 = add i32 %3, 1              ; <i32> [#uses=1]
52         store i32 %4, i32* @_C_nextcmd, align 4
53         %5 = call arm_apcscc  noalias i8* @calloc(i32 22, i32 1) nounwind               ; <i8*> [#uses=0]
54         unreachable
55
56 bb35.i:         ; preds = %bb42.i
57         %6 = call arm_apcscc  noalias i8* @calloc(i32 20, i32 1) nounwind               ; <i8*> [#uses=0]
58         unreachable
59
60 bb37.i:         ; preds = %bb42.i
61         %7 = call arm_apcscc  noalias i8* @calloc(i32 14, i32 1) nounwind               ; <i8*> [#uses=0]
62         unreachable
63
64 bb39.i:         ; preds = %bb42.i
65         call arm_apcscc  void @Z_fatal(i8* getelementptr ([28 x i8]* @.str31, i32 0, i32 0)) nounwind
66         unreachable
67
68 bb40.i:         ; preds = %bb42.i, %bb5.i, %bb1.i2
69         %_Y_flags.0 = phi i32 [ 0, %bb1.i2 ], [ %0, %bb5.i ], [ %_Y_flags.1, %bb42.i ]          ; <i32> [#uses=1]
70         %_Y_eflag.b.0 = phi i1 [ %_Y_eflag.b.1, %bb1.i2 ], [ %_Y_eflag.b.1, %bb5.i ], [ true, %bb42.i ]         ; <i1> [#uses=1]
71         br label %bb42.i
72
73 bb42.i:         ; preds = %bb40.i, %entry
74         %_Y_eflag.b.1 = phi i1 [ false, %entry ], [ %_Y_eflag.b.0, %bb40.i ]            ; <i1> [#uses=2]
75         %_Y_flags.1 = phi i32 [ 0, %entry ], [ %_Y_flags.0, %bb40.i ]           ; <i32> [#uses=2]
76         switch i32 undef, label %bb39.i [
77                 i32 67, label %bb33.i
78                 i32 70, label %bb35.i
79                 i32 77, label %bb37.i
80                 i32 83, label %bb34.i
81                 i32 97, label %bb7.i
82                 i32 100, label %bb5.i
83                 i32 101, label %bb40.i
84                 i32 102, label %bb23.i
85                 i32 105, label %bb15.i
86                 i32 116, label %bb1.i2
87         ]
88 }
89
90 declare arm_apcscc void @_T_addtol(%struct._T_tstr** nocapture, i32, i8*) nounwind