1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=sparc-none-linux-gnu < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; This test checks that LLVM can do basic stripping and reapplying of branches 4*9880d681SAndroid Build Coastguard Worker; to basic blocks. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdeclare void @test_true() 7*9880d681SAndroid Build Coastguard Workerdeclare void @test_false() 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; !0 corresponds to a branch being taken, !1 to not being takne. 10*9880d681SAndroid Build Coastguard Worker!0 = !{!"branch_weights", i32 64, i32 4} 11*9880d681SAndroid Build Coastguard Worker!1 = !{!"branch_weights", i32 4, i32 64} 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Workerdefine void @test_Bcc_fallthrough_taken(i32 %in) nounwind { 14*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_Bcc_fallthrough_taken: 15*9880d681SAndroid Build Coastguard Worker %tst = icmp eq i32 %in, 42 16*9880d681SAndroid Build Coastguard Worker br i1 %tst, label %true, label %false, !prof !0 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; CHECK: cmp {{%[goli][0-9]+}}, 42 19*9880d681SAndroid Build Coastguard Worker; CHECK: bne [[FALSE:.LBB[0-9]+_[0-9]+]] 20*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: nop 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ! BB# 22*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call test_true 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; CHECK: [[FALSE]]: 25*9880d681SAndroid Build Coastguard Worker; CHECK: call test_false 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Workertrue: 28*9880d681SAndroid Build Coastguard Worker call void @test_true() 29*9880d681SAndroid Build Coastguard Worker ret void 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Workerfalse: 32*9880d681SAndroid Build Coastguard Worker call void @test_false() 33*9880d681SAndroid Build Coastguard Worker ret void 34*9880d681SAndroid Build Coastguard Worker} 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerdefine void @test_Bcc_fallthrough_nottaken(i32 %in) nounwind { 37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_Bcc_fallthrough_nottaken: 38*9880d681SAndroid Build Coastguard Worker %tst = icmp eq i32 %in, 42 39*9880d681SAndroid Build Coastguard Worker br i1 %tst, label %true, label %false, !prof !1 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; CHECK: cmp {{%[goli][0-9]+}}, 42 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; CHECK: be [[TRUE:.LBB[0-9]+_[0-9]+]] 44*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: nop 45*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ! BB# 46*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call test_false 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker; CHECK: [[TRUE]]: 49*9880d681SAndroid Build Coastguard Worker; CHECK: call test_true 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workertrue: 52*9880d681SAndroid Build Coastguard Worker call void @test_true() 53*9880d681SAndroid Build Coastguard Worker ret void 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Workerfalse: 56*9880d681SAndroid Build Coastguard Worker call void @test_false() 57*9880d681SAndroid Build Coastguard Worker ret void 58*9880d681SAndroid Build Coastguard Worker} 59