1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O1 -mcpu=atom -mtriple=i686-linux | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @external_function(...) 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdefine i32 @test_return_val(i32 %a) nounwind { 6*9880d681SAndroid Build Coastguard Worker; CHECK: test_return_val 7*9880d681SAndroid Build Coastguard Worker; CHECK: movl 8*9880d681SAndroid Build Coastguard Worker; CHECK: nop 9*9880d681SAndroid Build Coastguard Worker; CHECK: nop 10*9880d681SAndroid Build Coastguard Worker; CHECK: nop 11*9880d681SAndroid Build Coastguard Worker; CHECK: nop 12*9880d681SAndroid Build Coastguard Worker; CHECK: nop 13*9880d681SAndroid Build Coastguard Worker; CHECK: nop 14*9880d681SAndroid Build Coastguard Worker; CHECK: ret 15*9880d681SAndroid Build Coastguard Worker ret i32 %a 16*9880d681SAndroid Build Coastguard Worker} 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Workerdefine i32 @test_optsize(i32 %a) nounwind optsize { 19*9880d681SAndroid Build Coastguard Worker; CHECK: test_optsize 20*9880d681SAndroid Build Coastguard Worker; CHECK: movl 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret 22*9880d681SAndroid Build Coastguard Worker ret i32 %a 23*9880d681SAndroid Build Coastguard Worker} 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Workerdefine i32 @test_minsize(i32 %a) nounwind minsize { 26*9880d681SAndroid Build Coastguard Worker; CHECK: test_minsize 27*9880d681SAndroid Build Coastguard Worker; CHECK: movl 28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret 29*9880d681SAndroid Build Coastguard Worker ret i32 %a 30*9880d681SAndroid Build Coastguard Worker} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerdefine i32 @test_add(i32 %a, i32 %b) nounwind { 33*9880d681SAndroid Build Coastguard Worker; CHECK: test_add 34*9880d681SAndroid Build Coastguard Worker; CHECK: addl 35*9880d681SAndroid Build Coastguard Worker; CHECK: nop 36*9880d681SAndroid Build Coastguard Worker; CHECK: nop 37*9880d681SAndroid Build Coastguard Worker; CHECK: nop 38*9880d681SAndroid Build Coastguard Worker; CHECK: nop 39*9880d681SAndroid Build Coastguard Worker; CHECK: ret 40*9880d681SAndroid Build Coastguard Worker %result = add i32 %a, %b 41*9880d681SAndroid Build Coastguard Worker ret i32 %result 42*9880d681SAndroid Build Coastguard Worker} 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Workerdefine i32 @test_multiple_ret(i32 %a, i32 %b, i1 %c) nounwind { 45*9880d681SAndroid Build Coastguard Worker; CHECK: @test_multiple_ret 46*9880d681SAndroid Build Coastguard Worker; CHECK: je 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker; CHECK: nop 49*9880d681SAndroid Build Coastguard Worker; CHECK: nop 50*9880d681SAndroid Build Coastguard Worker; CHECK: ret 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker; CHECK: nop 53*9880d681SAndroid Build Coastguard Worker; CHECK: nop 54*9880d681SAndroid Build Coastguard Worker; CHECK: ret 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Worker br i1 %c, label %bb1, label %bb2 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Workerbb1: 59*9880d681SAndroid Build Coastguard Worker ret i32 %a 60*9880d681SAndroid Build Coastguard Worker 61*9880d681SAndroid Build Coastguard Workerbb2: 62*9880d681SAndroid Build Coastguard Worker ret i32 %b 63*9880d681SAndroid Build Coastguard Worker} 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Workerdefine void @test_call_others(i32 %x) nounwind 66*9880d681SAndroid Build Coastguard Worker{ 67*9880d681SAndroid Build Coastguard Worker; CHECK: test_call_others 68*9880d681SAndroid Build Coastguard Worker; CHECK: je 69*9880d681SAndroid Build Coastguard Worker %tobool = icmp eq i32 %x, 0 70*9880d681SAndroid Build Coastguard Worker br i1 %tobool, label %if.end, label %true.case 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Worker; CHECK: jmp external_function 73*9880d681SAndroid Build Coastguard Workertrue.case: 74*9880d681SAndroid Build Coastguard Worker tail call void bitcast (void (...)* @external_function to void ()*)() nounwind 75*9880d681SAndroid Build Coastguard Worker br label %if.end 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker; CHECK: nop 78*9880d681SAndroid Build Coastguard Worker; CHECK: nop 79*9880d681SAndroid Build Coastguard Worker; CHECK: nop 80*9880d681SAndroid Build Coastguard Worker; CHECK: nop 81*9880d681SAndroid Build Coastguard Worker; CHECK: ret 82*9880d681SAndroid Build Coastguard Workerif.end: 83*9880d681SAndroid Build Coastguard Worker ret void 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Worker} 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Workerdefine void @test_branch_to_same_bb(i32 %x, i32 %y) nounwind { 88*9880d681SAndroid Build Coastguard Worker; CHECK: @test_branch_to_same_bb 89*9880d681SAndroid Build Coastguard Worker %cmp = icmp sgt i32 %x, 0 90*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %while.cond, label %while.end 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Workerwhile.cond: 93*9880d681SAndroid Build Coastguard Worker br label %while.cond 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Worker; CHECK: nop 96*9880d681SAndroid Build Coastguard Worker; CHECK: nop 97*9880d681SAndroid Build Coastguard Worker; CHECK: nop 98*9880d681SAndroid Build Coastguard Worker; CHECK: nop 99*9880d681SAndroid Build Coastguard Worker; CHECK: ret 100*9880d681SAndroid Build Coastguard Workerwhile.end: 101*9880d681SAndroid Build Coastguard Worker ret void 102*9880d681SAndroid Build Coastguard Worker} 103*9880d681SAndroid Build Coastguard Worker 104