OLD | NEW |
1 ; RUIN: %llvm2ice --verbose none %s | FileCheck %s | 1 ; This is a basic test of the alloca instruction - one test for alloca |
2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 2 ; of a fixed size, and one test for variable size. |
| 3 |
| 4 ; RUIN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s |
| 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
3 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 7 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
4 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 8 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
5 ; RUN: | FileCheck --check-prefix=DUMP %s | 9 ; RUN: | FileCheck --check-prefix=DUMP %s |
6 | 10 |
7 define void @fixed_400(i32 %n) { | 11 define void @fixed_400(i32 %n) { |
8 entry: | 12 entry: |
9 %array = alloca i8, i32 400, align 16 | 13 %array = alloca i8, i32 400, align 16 |
10 %__2 = ptrtoint i8* %array to i32 | 14 %__2 = ptrtoint i8* %array to i32 |
11 call void @f1(i32 %__2) | 15 call void @f1(i32 %__2) |
12 ret void | 16 ret void |
13 ; CHECK: sub esp, 400 | |
14 ; CHECK-NEXT: mov eax, esp | |
15 ; CHECK-NEXT: push eax | |
16 ; CHECK-NEXT: call f1 | |
17 } | 17 } |
| 18 ; CHECK: fixed_400: |
| 19 ; CHECK: sub esp, 400 |
| 20 ; CHECK-NEXT: mov eax, esp |
| 21 ; CHECK-NEXT: push eax |
| 22 ; CHECK-NEXT: call f1 |
| 23 ; |
| 24 ; OPTM1: fixed_400: |
| 25 ; OPTM1: sub esp, 400 |
| 26 ; OPTM1-NEXT: mov {{.*}}, esp |
| 27 ; OPTM1: push |
| 28 ; OPTM1-NEXT: call f1 |
18 | 29 |
19 declare void @f1(i32) | 30 declare void @f1(i32) |
20 | 31 |
21 define void @variable_n(i32 %n) { | 32 define void @variable_n(i32 %n) { |
22 entry: | 33 entry: |
23 %array = alloca i8, i32 %n, align 16 | 34 %array = alloca i8, i32 %n, align 16 |
24 %__2 = ptrtoint i8* %array to i32 | 35 %__2 = ptrtoint i8* %array to i32 |
25 call void @f2(i32 %__2) | 36 call void @f2(i32 %__2) |
26 ret void | 37 ret void |
27 ; CHECK: mov eax, dword ptr [ebp+8] | |
28 ; CHECK-NEXT: sub esp, eax | |
29 ; CHECK-NEXT: mov eax, esp | |
30 ; CHECK-NEXT: push eax | |
31 ; CHECK-NEXT: call f2 | |
32 } | 38 } |
| 39 ; CHECK: variable_n: |
| 40 ; CHECK: mov eax, dword ptr [ebp+8] |
| 41 ; CHECK-NEXT: sub esp, eax |
| 42 ; CHECK-NEXT: mov eax, esp |
| 43 ; CHECK-NEXT: push eax |
| 44 ; CHECK-NEXT: call f2 |
| 45 ; |
| 46 ; OPTM1: variable_n: |
| 47 ; OPTM1: mov {{.*}}, esp |
| 48 ; OPTM1: push |
| 49 ; OPTM1-NEXT: call f2 |
33 | 50 |
34 declare void @f2(i32) | 51 declare void @f2(i32) |
35 | 52 |
36 ; ERRORS-NOT: ICE translation error | 53 ; ERRORS-NOT: ICE translation error |
37 ; DUMP-NOT: SZ | 54 ; DUMP-NOT: SZ |
OLD | NEW |