xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/inalloca.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker%Foo = type { i32, i32 }
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare void @f(%Foo* inalloca %b)
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @a() {
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: _a:
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  %b = alloca inalloca %Foo
11*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
12*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
13*9880d681SAndroid Build Coastguard Worker  %f1 = getelementptr %Foo, %Foo* %b, i32 0, i32 0
14*9880d681SAndroid Build Coastguard Worker  %f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
15*9880d681SAndroid Build Coastguard Worker  store i32 13, i32* %f1
16*9880d681SAndroid Build Coastguard Worker  store i32 42, i32* %f2
17*9880d681SAndroid Build Coastguard Worker; CHECK: movl %esp, %eax
18*9880d681SAndroid Build Coastguard Worker; CHECK: movl    $13, (%eax)
19*9880d681SAndroid Build Coastguard Worker; CHECK: movl    $42, 4(%eax)
20*9880d681SAndroid Build Coastguard Worker  call void @f(%Foo* inalloca %b)
21*9880d681SAndroid Build Coastguard Worker; CHECK: calll   _f
22*9880d681SAndroid Build Coastguard Worker  ret void
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdeclare void @inreg_with_inalloca(i32 inreg %a, %Foo* inalloca %b)
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine void @b() {
28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: _b:
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker  %b = alloca inalloca %Foo
31*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
32*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
33*9880d681SAndroid Build Coastguard Worker  %f1 = getelementptr %Foo, %Foo* %b, i32 0, i32 0
34*9880d681SAndroid Build Coastguard Worker  %f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
35*9880d681SAndroid Build Coastguard Worker  store i32 13, i32* %f1
36*9880d681SAndroid Build Coastguard Worker  store i32 42, i32* %f2
37*9880d681SAndroid Build Coastguard Worker; CHECK: movl %esp, %eax
38*9880d681SAndroid Build Coastguard Worker; CHECK: movl    $13, (%eax)
39*9880d681SAndroid Build Coastguard Worker; CHECK: movl    $42, 4(%eax)
40*9880d681SAndroid Build Coastguard Worker  call void @inreg_with_inalloca(i32 inreg 1, %Foo* inalloca %b)
41*9880d681SAndroid Build Coastguard Worker; CHECK: movl    $1, %eax
42*9880d681SAndroid Build Coastguard Worker; CHECK: calll   _inreg_with_inalloca
43*9880d681SAndroid Build Coastguard Worker  ret void
44*9880d681SAndroid Build Coastguard Worker}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerdeclare x86_thiscallcc void @thiscall_with_inalloca(i8* %a, %Foo* inalloca %b)
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workerdefine void @c() {
49*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: _c:
50*9880d681SAndroid Build Coastguard Workerentry:
51*9880d681SAndroid Build Coastguard Worker  %b = alloca inalloca %Foo
52*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
53*9880d681SAndroid Build Coastguard Worker; CHECK: pushl   %eax
54*9880d681SAndroid Build Coastguard Worker  %f1 = getelementptr %Foo, %Foo* %b, i32 0, i32 0
55*9880d681SAndroid Build Coastguard Worker  %f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
56*9880d681SAndroid Build Coastguard Worker  store i32 13, i32* %f1
57*9880d681SAndroid Build Coastguard Worker  store i32 42, i32* %f2
58*9880d681SAndroid Build Coastguard Worker; CHECK: movl %esp, %eax
59*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movl    $13, (%eax)
60*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movl    $42, 4(%eax)
61*9880d681SAndroid Build Coastguard Worker  call x86_thiscallcc void @thiscall_with_inalloca(i8* null, %Foo* inalloca %b)
62*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: xorl    %ecx, %ecx
63*9880d681SAndroid Build Coastguard Worker; CHECK: calll   _thiscall_with_inalloca
64*9880d681SAndroid Build Coastguard Worker  ret void
65*9880d681SAndroid Build Coastguard Worker}
66