1 ;RUN: llc -march=sparc < %s | FileCheck %s 2 ;RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=UNOPT 3 4 5 define i32 @test(i32 %a) nounwind { 6 entry: 7 ; CHECK: test 8 ; CHECK: call bar 9 ; CHECK-NOT: nop 10 ; CHECK: jmp 11 ; CHECK-NEXT: restore 12 %0 = tail call i32 @bar(i32 %a) nounwind 13 ret i32 %0 14 } 15 16 define i32 @test_jmpl(i32 (i32, i32)* nocapture %f, i32 %a, i32 %b) nounwind { 17 entry: 18 ; CHECK: test_jmpl 19 ; CHECK: call 20 ; CHECK-NOT: nop 21 ; CHECK: jmp 22 ; CHECK-NEXT: restore 23 %0 = tail call i32 %f(i32 %a, i32 %b) nounwind 24 ret i32 %0 25 } 26 27 define i32 @test_loop(i32 %a, i32 %b) nounwind readnone { 28 ; CHECK: test_loop 29 entry: 30 %0 = icmp sgt i32 %b, 0 31 br i1 %0, label %bb, label %bb5 32 33 bb: ; preds = %entry, %bb 34 %a_addr.18 = phi i32 [ %a_addr.0, %bb ], [ %a, %entry ] 35 %1 = phi i32 [ %3, %bb ], [ 0, %entry ] 36 %tmp9 = mul i32 %1, %b 37 %2 = and i32 %1, 1 38 %tmp = xor i32 %2, 1 39 %.pn = shl i32 %tmp9, %tmp 40 %a_addr.0 = add i32 %.pn, %a_addr.18 41 %3 = add nsw i32 %1, 1 42 %exitcond = icmp eq i32 %3, %b 43 ;CHECK: subcc 44 ;CHECK: bne 45 ;CHECK-NOT: nop 46 br i1 %exitcond, label %bb5, label %bb 47 48 bb5: ; preds = %bb, %entry 49 %a_addr.1.lcssa = phi i32 [ %a, %entry ], [ %a_addr.0, %bb ] 50 ;CHECK: jmp 51 ;CHECK-NEXT: restore 52 ret i32 %a_addr.1.lcssa 53 } 54 55 define i32 @test_inlineasm(i32 %a) nounwind { 56 entry: 57 ;CHECK: test_inlineasm 58 ;CHECK: sethi 59 ;CHECK: !NO_APP 60 ;CHECK-NEXT: subcc 61 ;CHECK-NEXT: bg 62 ;CHECK-NEXT: nop 63 tail call void asm sideeffect "sethi 0, %g0", ""() nounwind 64 %0 = icmp slt i32 %a, 0 65 br i1 %0, label %bb, label %bb1 66 67 bb: ; preds = %entry 68 %1 = tail call i32 (...)* @foo(i32 %a) nounwind 69 ret i32 %1 70 71 bb1: ; preds = %entry 72 %2 = tail call i32 @bar(i32 %a) nounwind 73 ret i32 %2 74 } 75 76 declare i32 @foo(...) 77 78 declare i32 @bar(i32) 79 80 81 define i32 @test_implicit_def() nounwind { 82 entry: 83 ;UNOPT: test_implicit_def 84 ;UNOPT: call func 85 ;UNOPT-NEXT: nop 86 %0 = tail call i32 @func(i32* undef) nounwind 87 ret i32 0 88 } 89 90 declare i32 @func(i32*) 91