OLD | NEW |
---|---|
1 ; This is a basic test of the alloca instruction - one test for alloca | 1 ; This is a basic test of the alloca instruction - tests for alloca of |
2 ; of a fixed size, and one test for variable size. | 2 ; a fixed size and for variable size. |
3 | 3 |
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s | 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s | 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
6 ; RUN: %llvm2ice -O2 --verbose none %s \ | 6 ; RUN: %llvm2ice -O2 --verbose none %s \ |
7 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 7 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
8 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 8 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
9 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 9 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
13 ; RUN: | FileCheck --check-prefix=DUMP %s | 13 ; RUN: | FileCheck --check-prefix=DUMP %s |
14 | 14 |
15 define void @fixed_400(i32 %n) { | 15 define void @fixed_400(i32 %n) { |
16 entry: | 16 entry: |
17 %array = alloca i8, i32 400, align 16 | 17 %array = alloca i8, i32 400, align 16 |
18 %__2 = ptrtoint i8* %array to i32 | 18 %__2 = ptrtoint i8* %array to i32 |
19 call void @f1(i32 %__2) | 19 call void @f1(i32 %__2) |
20 ret void | 20 ret void |
21 } | 21 } |
22 ; CHECK: fixed_400: | 22 ; CHECK: fixed_400: |
23 ; CHECK: sub esp, 400 | 23 ; CHECK: sub esp, 400 |
24 ; CHECK-NEXT: mov eax, esp | 24 ; CHECK: sub esp, 16 |
25 ; CHECK-NEXT: push eax | 25 ; CHECK: mov dword ptr [esp], eax |
26 ; CHECK-NEXT: call f1 | 26 ; CHECK: call f1 |
27 ; | 27 |
28 ; OPTM1: fixed_400: | 28 define void @fixed_351(i32 %n) { |
29 ; OPTM1: sub esp, 400 | 29 entry: |
30 ; OPTM1-NEXT: mov {{.*}}, esp | 30 %array = alloca i8, i32 351, align 16 |
31 ; OPTM1: push | 31 %__2 = ptrtoint i8* %array to i32 |
32 ; OPTM1-NEXT: call f1 | 32 call void @f1(i32 %__2) |
33 ret void | |
34 } | |
35 ; CHECK: fixed_351: | |
36 ; CHECK: sub esp, 352 | |
37 ; CHECK: sub esp, 16 | |
38 ; CHECK: mov dword ptr [esp], eax | |
39 ; CHECK: call f1 | |
33 | 40 |
34 declare void @f1(i32) | 41 declare void @f1(i32) |
35 | 42 |
36 define void @variable_n(i32 %n) { | 43 define void @variable_n(i32 %n) { |
37 entry: | 44 entry: |
38 %array = alloca i8, i32 %n, align 16 | 45 %array = alloca i8, i32 %n, align 16 |
39 %__2 = ptrtoint i8* %array to i32 | 46 %__2 = ptrtoint i8* %array to i32 |
40 call void @f2(i32 %__2) | 47 call void @f2(i32 %__2) |
41 ret void | 48 ret void |
42 } | 49 } |
43 ; CHECK: variable_n: | 50 ; CHECK: variable_n: |
44 ; CHECK: mov eax, dword ptr [ebp+8] | 51 ; CHECK: mov eax, dword ptr [ebp+8] |
52 ; CHECK-NEXT: add eax, 15 | |
53 ; CHECK-NEXT: and eax, 18446744073709551600 | |
Jim Stichnoth
2014/08/05 18:09:27
What is a 64-bit integer immediate doing in an x86
wala
2014/08/05 23:57:03
This should be -16. I'm not entirely sure what cau
| |
45 ; CHECK-NEXT: sub esp, eax | 54 ; CHECK-NEXT: sub esp, eax |
46 ; CHECK-NEXT: mov eax, esp | 55 ; CHECK: sub esp, 16 |
47 ; CHECK-NEXT: push eax | 56 ; CHECK: mov dword ptr [esp], eax |
48 ; CHECK-NEXT: call f2 | 57 ; CHECK: call f2 |
49 ; | |
50 ; OPTM1: variable_n: | |
51 ; OPTM1: mov {{.*}}, esp | |
52 ; OPTM1: push | |
53 ; OPTM1-NEXT: call f2 | |
54 | 58 |
55 declare void @f2(i32) | 59 declare void @f2(i32) |
56 | 60 |
57 ; ERRORS-NOT: ICE translation error | 61 ; ERRORS-NOT: ICE translation error |
58 ; DUMP-NOT: SZ | 62 ; DUMP-NOT: SZ |
OLD | NEW |