104 lines · plain
1; RUN: llc < %s -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s --check-prefix=CHECK --check-prefix=T22; RUN: llc < %s -mtriple=thumbv6m-apple-darwin -relocation-model=pic | FileCheck %s --check-prefix=T1DISABLED3; FIXME: llc < %s -mtriple=thumbv6m-apple-darwin -relocation-model=pic | FileCheck %s --check-prefix=CHECK --check-prefix=T14; FIXME: llc < %s -mtriple=thumbv6m-apple-darwin -relocation-model=static | FileCheck %s --check-prefix=CHECK --check-prefix=T15 6; FIXME: Thumb1 tests temporarily disabled; MachineLICM is now hoisting the7; subs, so the jump table can't be formed.8; T1DISABLED: .data_region jt329 10; Thumb2 target should reorder the bb's in order to use tbb / tbh.11 12 %struct.R_flstr = type { i32, i32, ptr }13 %struct._T_tstr = type { i32, ptr, ptr }14@_C_nextcmd = external global i32 ; <ptr> [#uses=3]15@.str31 = external constant [28 x i8], align 1 ; <ptr> [#uses=1]16@_T_gtol = external global ptr ; <ptr> [#uses=2]17 18declare i32 @strlen(ptr nocapture) nounwind readonly19 20declare void @Z_fatal(ptr) noreturn nounwind21 22declare noalias ptr @calloc(i32, i32) nounwind23 24; Jump tables are not anchored next to the TBB/TBH any more. Make sure the25; correct address is still calculated (i.e. via a PC-relative symbol *at* the26; TBB/TBH).27define i32 @main(i32 %argc, ptr nocapture %argv) nounwind {28; CHECK-LABEL: main:29; CHECK-NOT: adr {{r[0-9]+}}, LJTI30; T1: lsls r[[x:[0-9]+]], {{r[0-9]+}}, #131; CHECK: [[PCREL_ANCHOR:LCPI[0-9]+_[0-9]+]]:32; T2-NEXT: tbb [pc, {{r[0-9]+}}]33; T1-NEXT: add pc, r[[x]]34 35; CHECK: LJTI0_0:36; CHECK-NEXT: .data_region jt837; CHECK-NEXT: .byte (LBB{{[0-9]+_[0-9]+}}-([[PCREL_ANCHOR]]+4))/238 39entry:40 br label %bb42.i41 42bb1.i2: ; preds = %bb42.i43 br label %bb40.i44 45bb5.i: ; preds = %bb42.i46 %0 = or i32 %argc, 32 ; <i32> [#uses=1]47 br label %bb40.i48 49bb7.i: ; preds = %bb42.i50 call void @_T_addtol(ptr @_T_gtol, i32 0, ptr null) nounwind51 unreachable52 53bb15.i: ; preds = %bb42.i54 call void @_T_addtol(ptr @_T_gtol, i32 2, ptr null) nounwind55 unreachable56 57bb23.i: ; preds = %bb42.i58 %1 = call i32 @strlen(ptr null) nounwind readonly ; <i32> [#uses=0]59 unreachable60 61bb33.i: ; preds = %bb42.i62 store i32 0, ptr @_C_nextcmd, align 463 %2 = call noalias ptr @calloc(i32 21, i32 1) nounwind ; <ptr> [#uses=0]64 unreachable65 66bb34.i: ; preds = %bb42.i67 %3 = load i32, ptr @_C_nextcmd, align 4 ; <i32> [#uses=1]68 %4 = add i32 %3, 1 ; <i32> [#uses=1]69 store i32 %4, ptr @_C_nextcmd, align 470 %5 = call noalias ptr @calloc(i32 22, i32 1) nounwind ; <ptr> [#uses=0]71 unreachable72 73bb35.i: ; preds = %bb42.i74 %6 = call noalias ptr @calloc(i32 20, i32 1) nounwind ; <ptr> [#uses=0]75 unreachable76 77bb37.i: ; preds = %bb42.i78 %7 = call noalias ptr @calloc(i32 14, i32 1) nounwind ; <ptr> [#uses=0]79 unreachable80 81bb39.i: ; preds = %bb42.i82 call void @Z_fatal(ptr @.str31) nounwind83 unreachable84 85bb40.i: ; preds = %bb42.i, %bb5.i, %bb1.i286 br label %bb42.i87 88bb42.i: ; preds = %bb40.i, %entry89 switch i32 %argc, label %bb39.i [90 i32 67, label %bb33.i91 i32 70, label %bb35.i92 i32 77, label %bb37.i93 i32 83, label %bb34.i94 i32 97, label %bb7.i95 i32 100, label %bb5.i96 i32 101, label %bb40.i97 i32 102, label %bb23.i98 i32 105, label %bb15.i99 i32 116, label %bb1.i2100 ]101}102 103declare void @_T_addtol(ptr nocapture, i32, ptr) nounwind104