OLD | NEW |
1 ; This tries to create variables with very large stack offsets. | 1 ; This tries to create variables with very large stack offsets. |
2 ; This requires a lot of variables/register pressure. To simplify this | 2 ; This requires a lot of variables/register pressure. To simplify this |
3 ; we assume poor register allocation from Om1, and a flag that forces | 3 ; we assume poor register allocation from Om1, and a flag that forces |
4 ; the frame to add K amount of unused stack for testing. | 4 ; the frame to add K amount of unused stack for testing. |
5 ; We only need to test ARM and other architectures which have limited space | 5 ; We only need to test ARM and other architectures which have limited space |
6 ; for specifying an offset within an instruction. | 6 ; for specifying an offset within an instruction. |
7 | 7 |
8 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 8 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
9 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target arm32 \ | 9 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target arm32 \ |
10 ; RUN: -i %s --args -Om1 --skip-unimplemented --test-stack-extra 4096 \ | 10 ; RUN: -i %s --args -Om1 --test-stack-extra 4096 \ |
11 ; RUN: -allow-externally-defined-symbols \ | 11 ; RUN: -allow-externally-defined-symbols \ |
12 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 12 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
13 ; RUN: --command FileCheck --check-prefix ARM32 %s | 13 ; RUN: --command FileCheck --check-prefix ARM32 %s |
14 | 14 |
15 declare i64 @dummy(i32 %t1, i32 %t2, i32 %t3, i64 %t4, i64 %t5) | 15 declare i64 @dummy(i32 %t1, i32 %t2, i32 %t3, i64 %t4, i64 %t5) |
16 | 16 |
17 ; Test a function that requires lots of stack (due to test flag), and uses | 17 ; Test a function that requires lots of stack (due to test flag), and uses |
18 ; SP as the base register (originally). | 18 ; SP as the base register (originally). |
19 define internal i64 @lotsOfStack(i32 %a, i32 %b, i32 %c, i32 %d) { | 19 define internal i64 @lotsOfStack(i32 %a, i32 %b, i32 %c, i32 %d) { |
20 entry: | 20 entry: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ; Use that to check the stack offset of %t2. The first offset and the | 56 ; Use that to check the stack offset of %t2. The first offset and the |
57 ; later offset right before the call should be 16 bytes apart, | 57 ; later offset right before the call should be 16 bytes apart, |
58 ; because of the sub sp, sp, #16. | 58 ; because of the sub sp, sp, #16. |
59 ; ARM32: orr [[REG:r.*]], {{.*}}, | 59 ; ARM32: orr [[REG:r.*]], {{.*}}, |
60 ; I.e., the slot for t2 is (sp0 + 4232 - 20) == sp0 + 4212. | 60 ; I.e., the slot for t2 is (sp0 + 4232 - 20) == sp0 + 4212. |
61 ; ARM32: str [[REG]], [ip, #-20] | 61 ; ARM32: str [[REG]], [ip, #-20] |
62 ; ARM32: b {{[a-f0-9]+}} | 62 ; ARM32: b {{[a-f0-9]+}} |
63 ; Now skip ahead to where the call in br_1 begins, to check how %t2 is used. | 63 ; Now skip ahead to where the call in br_1 begins, to check how %t2 is used. |
64 ; ARM32: movw ip, #4232 | 64 ; ARM32: movw ip, #4232 |
65 ; ARM32-NEXT: add ip, sp, ip | 65 ; ARM32-NEXT: add ip, sp, ip |
| 66 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} dummy |
| 67 ; ARM32: movt [[CALL]] |
66 ; ARM32: ldr r2, [ip, #-4] | 68 ; ARM32: ldr r2, [ip, #-4] |
67 ; ARM32: bl {{.*}} dummy | 69 ; ARM32: blx [[CALL]] |
68 ; The call clobbers ip, so we need to re-create the base register. | 70 ; The call clobbers ip, so we need to re-create the base register. |
69 ; ARM32: movw ip, #4{{.*}} | 71 ; ARM32: movw ip, #4{{.*}} |
70 ; ARM32: b {{[a-f0-9]+}} | 72 ; ARM32: b {{[a-f0-9]+}} |
71 ; ARM32: bl {{.*}} dummy | 73 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} dummy |
| 74 ; ARM32: movt [[CALL]] |
| 75 ; ARM32: blx [[CALL]] |
72 | 76 |
73 ; Similar, but test a function that uses FP as the base register (originally). | 77 ; Similar, but test a function that uses FP as the base register (originally). |
74 define internal i64 @usesFrameReg(i32 %a, i32 %b, i32 %c, i32 %d) { | 78 define internal i64 @usesFrameReg(i32 %a, i32 %b, i32 %c, i32 %d) { |
75 entry: | 79 entry: |
76 %p = alloca i8, i32 %d, align 4 | 80 %p = alloca i8, i32 %d, align 4 |
77 %t1 = xor i32 %a, %b | 81 %t1 = xor i32 %a, %b |
78 %t2 = or i32 %c, %d | 82 %t2 = or i32 %c, %d |
79 %cmp = icmp eq i32 %t1, %t2 | 83 %cmp = icmp eq i32 %t1, %t2 |
80 br i1 %cmp, label %br_1, label %br_2 | 84 br i1 %cmp, label %br_1, label %br_2 |
81 | 85 |
(...skipping 29 matching lines...) Expand all Loading... |
111 ; Use that to check the stack offset of %t2. It should be the same offset | 115 ; Use that to check the stack offset of %t2. It should be the same offset |
112 ; even after sub sp, sp, #16, because the base register was originally | 116 ; even after sub sp, sp, #16, because the base register was originally |
113 ; the FP and not the SP. | 117 ; the FP and not the SP. |
114 ; ARM32: orr [[REG:r.*]], {{.*}}, | 118 ; ARM32: orr [[REG:r.*]], {{.*}}, |
115 ; I.e., the slot for t2 is (fp0 - 4100 -24) == fp0 - 4124 | 119 ; I.e., the slot for t2 is (fp0 - 4100 -24) == fp0 - 4124 |
116 ; ARM32: str [[REG]], [ip, #-24] | 120 ; ARM32: str [[REG]], [ip, #-24] |
117 ; ARM32: b {{[a-f0-9]+}} | 121 ; ARM32: b {{[a-f0-9]+}} |
118 ; Now skip ahead to where the call in br_1 begins, to check how %t2 is used. | 122 ; Now skip ahead to where the call in br_1 begins, to check how %t2 is used. |
119 ; ARM32: movw ip, #4120 | 123 ; ARM32: movw ip, #4120 |
120 ; ARM32-NEXT: sub ip, fp, ip | 124 ; ARM32-NEXT: sub ip, fp, ip |
| 125 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} dummy |
| 126 ; ARM32: movt [[CALL]] |
121 ; ARM32: ldr r2, [ip, #-4] | 127 ; ARM32: ldr r2, [ip, #-4] |
122 ; ARM32: bl {{.*}} dummy | 128 ; ARM32: blx [[CALL]] |
123 ; The call clobbers ip, so we need to re-create the base register. | 129 ; The call clobbers ip, so we need to re-create the base register. |
124 ; ARM32: movw ip, #4{{.*}} | 130 ; ARM32: movw ip, #4{{.*}} |
125 ; ARM32: b {{[a-f0-9]+}} | 131 ; ARM32: b {{[a-f0-9]+}} |
126 ; ARM32: bl {{.*}} dummy | 132 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} dummy |
| 133 ; ARM32: movt [[CALL]] |
| 134 ; ARM32: blx [[CALL]] |
OLD | NEW |