OLD | NEW |
(Empty) | |
| 1 ; This checks to ensure that Subzero aligns spill slots. |
| 2 |
| 3 ; RUN: %llvm2ice --verbose none %s | FileCheck %s |
| 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 6 |
| 7 ; The location of the stack slot for a variable is inferred from the |
| 8 ; return sequence. |
| 9 |
| 10 ; In this file, "global" refers to a variable with a live range across |
| 11 ; multiple basic blocks (not an LLVM global variable) and "local" |
| 12 ; refers to a variable that is live in only a single basic block. |
| 13 |
| 14 define <4 x i32> @align_global_vector(i32 %arg) { |
| 15 entry: |
| 16 %vec.global = insertelement <4 x i32> undef, i32 %arg, i32 0 |
| 17 br label %block |
| 18 block: |
| 19 call void @ForceXmmSpills() |
| 20 ret <4 x i32> %vec.global |
| 21 ; CHECK-LABEL: align_global_vector: |
| 22 ; CHECK: movups xmm0, xmmword ptr [esp] |
| 23 ; CHECK-NEXT: add esp, 28 |
| 24 ; CHECK-NEXT: ret |
| 25 } |
| 26 |
| 27 define <4 x i32> @align_local_vector(i32 %arg) { |
| 28 entry: |
| 29 br label %block |
| 30 block: |
| 31 %vec.local = insertelement <4 x i32> undef, i32 %arg, i32 0 |
| 32 call void @ForceXmmSpills() |
| 33 ret <4 x i32> %vec.local |
| 34 ; CHECK-LABEL: align_local_vector: |
| 35 ; CHECK: movups xmm0, xmmword ptr [esp] |
| 36 ; CHECK-NEXT: add esp, 28 |
| 37 ; CHECK-NEXT: ret |
| 38 } |
| 39 |
| 40 declare void @ForceXmmSpills() |
| 41 |
| 42 define <4 x i32> @align_global_vector_ebp_based(i32 %arg) { |
| 43 entry: |
| 44 %alloc = alloca i8, i32 1, align 1 |
| 45 %vec.global = insertelement <4 x i32> undef, i32 %arg, i32 0 |
| 46 br label %block |
| 47 block: |
| 48 call void @ForceXmmSpillsAndUseAlloca(i8* %alloc) |
| 49 ret <4 x i32> %vec.global |
| 50 ; CHECK-LABEL: align_global_vector_ebp_based: |
| 51 ; CHECK: movups xmm0, xmmword ptr [ebp-24] |
| 52 ; CHECK-NEXT: mov esp, ebp |
| 53 ; CHECK-NEXT: pop ebp |
| 54 ; CHECK: ret |
| 55 } |
| 56 |
| 57 define <4 x i32> @align_local_vector_ebp_based(i32 %arg) { |
| 58 entry: |
| 59 %alloc = alloca i8, i32 1, align 1 |
| 60 %vec.local = insertelement <4 x i32> undef, i32 %arg, i32 0 |
| 61 call void @ForceXmmSpillsAndUseAlloca(i8* %alloc) |
| 62 ret <4 x i32> %vec.local |
| 63 ; CHECK-LABEL: align_local_vector_ebp_based: |
| 64 ; CHECK: movups xmm0, xmmword ptr [ebp-24] |
| 65 ; CHECK-NEXT: mov esp, ebp |
| 66 ; CHECK-NEXT: pop ebp |
| 67 ; CHECK: ret |
| 68 } |
| 69 |
| 70 define <4 x i32> @align_local_vector_and_global_float(i32 %arg) { |
| 71 entry: |
| 72 %float.global = sitofp i32 %arg to float |
| 73 call void @ForceXmmSpillsAndUseFloat(float %float.global) |
| 74 br label %block |
| 75 block: |
| 76 %vec.local = insertelement <4 x i32> undef, i32 undef, i32 0 |
| 77 call void @ForceXmmSpillsAndUseFloat(float %float.global) |
| 78 ret <4 x i32> %vec.local |
| 79 ; CHECK-LABEL: align_local_vector_and_global_float: |
| 80 ; CHECK: cvtsi2ss xmm0, eax |
| 81 ; CHECK-NEXT: movss dword ptr [esp+28], xmm0 |
| 82 ; CHECK: movups xmm0, xmmword ptr [esp] |
| 83 ; CHECK-NEXT: add esp, 44 |
| 84 ; CHECK-NEXT: ret |
| 85 } |
| 86 |
| 87 declare void @ForceXmmSpillsAndUseAlloca(i8*) |
| 88 declare void @ForceXmmSpillsAndUseFloat(float) |
| 89 |
| 90 ; ERRORS-NOT: ICE translation error |
OLD | NEW |