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