Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
      2 
      3 %Foo = type { i32, i32 }
      4 
      5 declare void @f(%Foo* inalloca %b)
      6 
      7 define void @a() {
      8 ; CHECK-LABEL: _a:
      9 entry:
     10   %b = alloca inalloca %Foo
     11 ; CHECK: movl    $8, %eax
     12 ; CHECK: calll   __chkstk
     13 ; CHECK: movl   %[[REG:[^,]*]], %esp
     14   %f1 = getelementptr %Foo* %b, i32 0, i32 0
     15   %f2 = getelementptr %Foo* %b, i32 0, i32 1
     16   store i32 13, i32* %f1
     17   store i32 42, i32* %f2
     18 ; CHECK: movl    $13, (%[[REG]])
     19 ; CHECK: movl    $42, 4(%[[REG]])
     20   call void @f(%Foo* inalloca %b)
     21 ; CHECK: calll   _f
     22   ret void
     23 }
     24 
     25 declare void @inreg_with_inalloca(i32 inreg %a, %Foo* inalloca %b)
     26 
     27 define void @b() {
     28 ; CHECK-LABEL: _b:
     29 entry:
     30   %b = alloca inalloca %Foo
     31 ; CHECK: movl    $8, %eax
     32 ; CHECK: calll   __chkstk
     33 ; CHECK: movl   %[[REG:[^,]*]], %esp
     34   %f1 = getelementptr %Foo* %b, i32 0, i32 0
     35   %f2 = getelementptr %Foo* %b, i32 0, i32 1
     36   store i32 13, i32* %f1
     37   store i32 42, i32* %f2
     38 ; CHECK: movl    $13, (%[[REG]])
     39 ; CHECK: movl    $42, 4(%[[REG]])
     40   call void @inreg_with_inalloca(i32 inreg 1, %Foo* inalloca %b)
     41 ; CHECK: movl    $1, %eax
     42 ; CHECK: calll   _inreg_with_inalloca
     43   ret void
     44 }
     45 
     46 declare x86_thiscallcc void @thiscall_with_inalloca(i8* %a, %Foo* inalloca %b)
     47 
     48 define void @c() {
     49 ; CHECK-LABEL: _c:
     50 entry:
     51   %b = alloca inalloca %Foo
     52 ; CHECK: movl    $8, %eax
     53 ; CHECK: calll   __chkstk
     54 ; CHECK: movl   %[[REG:[^,]*]], %esp
     55   %f1 = getelementptr %Foo* %b, i32 0, i32 0
     56   %f2 = getelementptr %Foo* %b, i32 0, i32 1
     57   store i32 13, i32* %f1
     58   store i32 42, i32* %f2
     59 ; CHECK-DAG: movl    $13, (%[[REG]])
     60 ; CHECK-DAG: movl    $42, 4(%[[REG]])
     61   call x86_thiscallcc void @thiscall_with_inalloca(i8* null, %Foo* inalloca %b)
     62 ; CHECK-DAG: xorl    %ecx, %ecx
     63 ; CHECK: calll   _thiscall_with_inalloca
     64   ret void
     65 }
     66