OLD | NEW |
1 ; This is a basic test of the alloca instruction and a call. | 1 ; This is a basic test of the alloca instruction and a call. |
2 | 2 |
3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
4 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ | 4 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ |
5 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
6 | 6 |
7 declare void @copy(i32 %arg1, i8* %arr1, i8* %arr2, i8* %arr3, i8* %arr4); | 7 declare void @copy(i32 %arg1, i8* %arr1, i8* %arr2, i8* %arr3, i8* %arr4); |
8 | 8 |
9 ; Test that alloca base addresses get passed correctly to functions. | 9 ; Test that alloca base addresses get passed correctly to functions. |
10 define internal void @caller1(i32 %arg) { | 10 define internal void @caller1(i32 %arg) { |
11 entry: | 11 entry: |
12 %a1 = alloca i8, i32 32, align 4 | 12 %a1 = alloca i8, i32 32, align 4 |
13 %p1 = bitcast i8* %a1 to i32* | 13 %p1 = bitcast i8* %a1 to i32* |
14 store i32 %arg, i32* %p1, align 1 | 14 store i32 %arg, i32* %p1, align 1 |
15 call void @copy(i32 %arg, i8* %a1, i8* %a1, i8* %a1, i8* %a1) | 15 call void @copy(i32 %arg, i8* %a1, i8* %a1, i8* %a1, i8* %a1) |
16 ret void | 16 ret void |
17 } | 17 } |
18 | 18 |
19 ; CHECK-LABEL: caller1 | 19 ; CHECK-LABEL: caller1 |
20 ; CHECK-NEXT: sub esp,0xc | 20 ; CHECK-NEXT: sub esp,0x2c |
21 ; CHECK-NEXT: mov eax,DWORD PTR [esp+0x10] | 21 ; CHECK-NEXT: mov eax,DWORD PTR [esp+0x30] |
22 ; CHECK-NEXT: sub esp,0x20 | |
23 ; CHECK-NEXT: mov ecx,esp | |
24 ; CHECK-NEXT: mov DWORD PTR [esp],eax | 22 ; CHECK-NEXT: mov DWORD PTR [esp],eax |
25 ; CHECK-NEXT: sub esp,0x20 | 23 ; CHECK-NEXT: sub esp,0x20 |
26 ; CHECK-NEXT: mov DWORD PTR [esp],eax | 24 ; CHECK-NEXT: mov DWORD PTR [esp],eax |
27 ; CHECK-NEXT: lea eax,[esp+0x20] | 25 ; CHECK-NEXT: lea eax,[esp+0x20] |
28 ; CHECK-NEXT: mov DWORD PTR [esp+0x4],eax | 26 ; CHECK-NEXT: mov DWORD PTR [esp+0x4],eax |
29 ; CHECK-NEXT: lea eax,[esp+0x20] | 27 ; CHECK-NEXT: lea eax,[esp+0x20] |
30 ; CHECK-NEXT: mov DWORD PTR [esp+0x8],eax | 28 ; CHECK-NEXT: mov DWORD PTR [esp+0x8],eax |
31 ; CHECK-NEXT: lea eax,[esp+0x20] | 29 ; CHECK-NEXT: lea eax,[esp+0x20] |
32 ; CHECK-NEXT: mov DWORD PTR [esp+0xc],eax | 30 ; CHECK-NEXT: mov DWORD PTR [esp+0xc],eax |
33 ; CHECK-NEXT: lea eax,[esp+0x20] | 31 ; CHECK-NEXT: lea eax,[esp+0x20] |
(...skipping 10 matching lines...) Expand all Loading... |
44 %a2 = alloca i8, i32 32, align 4 | 42 %a2 = alloca i8, i32 32, align 4 |
45 %p1 = bitcast i8* %a1 to i32* | 43 %p1 = bitcast i8* %a1 to i32* |
46 %p2 = bitcast i8* %a2 to i32* | 44 %p2 = bitcast i8* %a2 to i32* |
47 store i32 %arg, i32* %p1, align 1 | 45 store i32 %arg, i32* %p1, align 1 |
48 store i32 %arg, i32* %p2, align 1 | 46 store i32 %arg, i32* %p2, align 1 |
49 call void @copy(i32 %arg, i8* %a1, i8* %a2, i8* %a1, i8* %a2) | 47 call void @copy(i32 %arg, i8* %a1, i8* %a2, i8* %a1, i8* %a2) |
50 ret void | 48 ret void |
51 } | 49 } |
52 | 50 |
53 ; CHECK-LABEL: caller2 | 51 ; CHECK-LABEL: caller2 |
54 ; CHECK-NEXT: sub esp,0xc | 52 ; CHECK-NEXT: sub esp,0x4c |
55 ; CHECK-NEXT: mov eax,DWORD PTR [esp+0x10] | 53 ; CHECK-NEXT: mov eax,DWORD PTR [esp+0x50] |
56 ; CHECK-NEXT: sub esp,0x40 | |
57 ; CHECK-NEXT: mov ecx,esp | |
58 ; CHECK-NEXT: mov DWORD PTR [esp],eax | 54 ; CHECK-NEXT: mov DWORD PTR [esp],eax |
59 ; CHECK-NEXT: mov DWORD PTR [esp+0x20],eax | 55 ; CHECK-NEXT: mov DWORD PTR [esp+0x20],eax |
60 ; CHECK-NEXT: sub esp,0x20 | 56 ; CHECK-NEXT: sub esp,0x20 |
61 ; CHECK-NEXT: mov DWORD PTR [esp],eax | 57 ; CHECK-NEXT: mov DWORD PTR [esp],eax |
62 ; CHECK-NEXT: lea eax,[esp+0x20] | 58 ; CHECK-NEXT: lea eax,[esp+0x20] |
63 ; CHECK-NEXT: mov DWORD PTR [esp+0x4],eax | 59 ; CHECK-NEXT: mov DWORD PTR [esp+0x4],eax |
64 ; CHECK-NEXT: lea eax,[esp+0x40] | 60 ; CHECK-NEXT: lea eax,[esp+0x40] |
65 ; CHECK-NEXT: mov DWORD PTR [esp+0x8],eax | 61 ; CHECK-NEXT: mov DWORD PTR [esp+0x8],eax |
66 ; CHECK-NEXT: lea eax,[esp+0x20] | 62 ; CHECK-NEXT: lea eax,[esp+0x20] |
67 ; CHECK-NEXT: mov DWORD PTR [esp+0xc],eax | 63 ; CHECK-NEXT: mov DWORD PTR [esp+0xc],eax |
68 ; CHECK-NEXT: lea eax,[esp+0x40] | 64 ; CHECK-NEXT: lea eax,[esp+0x40] |
69 ; CHECK-NEXT: mov DWORD PTR [esp+0x10],eax | 65 ; CHECK-NEXT: mov DWORD PTR [esp+0x10],eax |
70 ; CHECK-NEXT: call | 66 ; CHECK-NEXT: call |
71 ; CHECK-NEXT: add esp,0x20 | 67 ; CHECK-NEXT: add esp,0x20 |
72 ; CHECK-NEXT: add esp,0x4c | 68 ; CHECK-NEXT: add esp,0x4c |
73 ; CHECK-NEXT: ret | 69 ; CHECK-NEXT: ret |
OLD | NEW |