Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s | FileCheck %s
      2 
      3 ; This should use flds to set the return value.
      4 ; CHECK: test0:
      5 ; CHECK: flds
      6 ; CHECK: ret
      7 @G = external global float
      8 define float @test0() nounwind {
      9   %t = load float* @G
     10   ret float %t
     11 }
     12 
     13 ; This should pop 4 bytes on return.
     14 ; CHECK: test1:
     15 ; CHECK: ret $4
     16 define void @test1({i32, i32, i32, i32}* sret %p) nounwind {
     17   store {i32, i32, i32, i32} zeroinitializer, {i32, i32, i32, i32}* %p
     18   ret void
     19 }
     20 
     21 ; Properly initialize the pic base.
     22 ; CHECK: test2:
     23 ; CHECK-NOT: HHH
     24 ; CHECK: call{{.*}}L2$pb
     25 ; CHECK-NEXT: L2$pb:
     26 ; CHECK-NEXT: pop
     27 ; CHECK: HHH
     28 ; CHECK: ret
     29 @HHH = external global i32
     30 define i32 @test2() nounwind {
     31   %t = load i32* @HHH
     32   ret i32 %t
     33 }
     34 
     35 ; Check that we fast-isel sret, and handle the callee-pops behavior correctly.
     36 %struct.a = type { i64, i64, i64 }
     37 define void @test3() nounwind ssp {
     38 entry:
     39   %tmp = alloca %struct.a, align 8
     40   call void @test3sret(%struct.a* sret %tmp)
     41   ret void
     42 ; CHECK: test3:
     43 ; CHECK: subl $44
     44 ; CHECK: leal 16(%esp)
     45 ; CHECK: calll _test3sret
     46 ; CHECK: addl $40
     47 }
     48 declare void @test3sret(%struct.a* sret)
     49 
     50 ; Check that fast-isel sret works with fastcc (and does not callee-pop)
     51 define void @test4() nounwind ssp {
     52 entry:
     53   %tmp = alloca %struct.a, align 8
     54   call fastcc void @test4fastccsret(%struct.a* sret %tmp)
     55   ret void
     56 ; CHECK: test4:
     57 ; CHECK: subl $28
     58 ; CHECK: leal (%esp), %ecx
     59 ; CHECK: calll _test4fastccsret
     60 ; CHECK: addl $28
     61 }
     62 declare fastcc void @test4fastccsret(%struct.a* sret)
     63