91 lines · plain
1; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s | FileCheck %s2; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s -pass-remarks-missed=isel 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s3 4; This should use flds to set the return value.5; CHECK-LABEL: test0:6; CHECK: flds7; CHECK: retl8@G = external global float9define float @test0() nounwind {10 %t = load float, ptr @G11 ret float %t12}13 14; This should pop 4 bytes on return.15; CHECK-LABEL: test1:16; CHECK: retl $417define void @test1(ptr sret({i32, i32, i32, i32}) %p) nounwind {18 store {i32, i32, i32, i32} zeroinitializer, ptr %p19 ret void20}21 22; This should pop 8 bytes on return.23; CHECK-LABEL: thiscallfun:24; CHECK: retl $825define x86_thiscallcc i32 @thiscallfun(ptr %this, i32 %a, i32 %b) nounwind {26; STDERR-NOT: FastISel missed terminator: ret i32 1234527 ret i32 1234528}29 30; Here, the callee pop doesn't fit the 16 bit immediate -- see x86-big-ret.ll31; This checks that -fast-isel doesn't miscompile this.32; CHECK-LABEL: thiscall_large:33; CHECK: popl %ecx34; CHECK-NEXT: addl $65536, %esp35; CHECK-NEXT: pushl %ecx36; CHECK-NEXT: retl37define x86_thiscallcc void @thiscall_large(ptr %this, ptr byval([65533 x i8]) %b) nounwind {38 ret void39}40 41; This should pop 4 bytes on return.42; CHECK-LABEL: stdcallfun:43; CHECK: retl $444define x86_stdcallcc i32 @stdcallfun(i32 %a) nounwind {45; STDERR-NOT: FastISel missed terminator: ret i32 5432146 ret i32 5432147}48 49; Properly initialize the pic base.50; CHECK-LABEL: test2:51; CHECK-NOT: HHH52; CHECK: call{{.*}}L5$pb53; CHECK-NEXT: L5$pb:54; CHECK-NEXT: pop55; CHECK: HHH56; CHECK: retl57@HHH = external global i3258define i32 @test2() nounwind {59 %t = load i32, ptr @HHH60 ret i32 %t61}62 63; Check that we fast-isel sret, and handle the callee-pops behavior correctly.64%struct.a = type { i64, i64, i64 }65define void @test3() nounwind ssp {66entry:67 %tmp = alloca %struct.a, align 868 call void @test3sret(ptr sret(%struct.a) %tmp)69 ret void70; CHECK-LABEL: test3:71; CHECK: subl $4472; CHECK: leal 16(%esp)73; CHECK: calll _test3sret74; CHECK: addl $4075}76declare void @test3sret(ptr sret(%struct.a))77 78; Check that fast-isel sret works with fastcc (and does not callee-pop)79define void @test4() nounwind ssp {80entry:81 %tmp = alloca %struct.a, align 882 call fastcc void @test4fastccsret(ptr sret(%struct.a) %tmp)83 ret void84; CHECK-LABEL: test4:85; CHECK: subl $2886; CHECK: movl %esp, %ecx87; CHECK: calll _test4fastccsret88; CHECK: addl $2889}90declare fastcc void @test4fastccsret(ptr sret(%struct.a))91