Index: tests_lit/llvm2ice_tests/align-spill-locations.ll |
diff --git a/tests_lit/llvm2ice_tests/align-spill-locations.ll b/tests_lit/llvm2ice_tests/align-spill-locations.ll |
new file mode 100644 |
index 0000000000000000000000000000000000000000..06ea62f0a79bcf4f92c7e7b754ec869676bde7d5 |
--- /dev/null |
+++ b/tests_lit/llvm2ice_tests/align-spill-locations.ll |
@@ -0,0 +1,72 @@ |
+; This checks to ensure that Subzero aligns spill slots. |
+ |
+; RUN: %llvm2ice --verbose none %s | FileCheck %s |
+; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
+; RUN: %llvm2ice -O2 --verbose none %s \ |
+; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
Jim Stichnoth
2014/08/13 23:59:34
Change the -arch lines per https://codereview.chro
wala
2014/08/14 17:31:24
These aren't really necessary, so I've removed the
|
+; RUN: %llvm2ice -Om1 --verbose none %s \ |
+; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
+; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
+ |
+; The location of the stack slot for a variable is inferred from the |
+; return sequence. |
+ |
+define <4 x i32> @align_global_vector(i32 %arg) { |
Jim Stichnoth
2014/08/13 23:59:34
Document the meaning of global versus local, other
wala
2014/08/14 17:31:24
Done.
|
+entry: |
+ %vec1 = insertelement <4 x i32> undef, i32 %arg, i32 0 |
+ br label %block |
+block: |
+ call void @ForceSpill() |
+ ret <4 x i32> %vec1 |
+; CHECK-LABEL: align_global_vector: |
+; CHECK: movups xmm0, xmmword ptr [esp] |
+; CHECK-NEXT: add esp, 28 |
+; CHECK-NEXT: ret |
+} |
+ |
+define <4 x i32> @align_local_vector(i32 %arg) { |
+entry: |
+ br label %block |
+block: |
+ %vec1 = insertelement <4 x i32> undef, i32 %arg, i32 0 |
+ call void @ForceSpill() |
+ ret <4 x i32> %vec1 |
+; CHECK-LABEL: align_local_vector: |
+; CHECK: movups xmm0, xmmword ptr [esp] |
+; CHECK-NEXT: add esp, 28 |
+; CHECK-NEXT: ret |
+} |
+ |
+declare void @ForceSpill() |
+ |
+define <4 x i32> @align_global_vector_ebp_based(i32 %arg) { |
+entry: |
+ %alloc = alloca i8, i32 1, align 1 |
+ %vec1 = insertelement <4 x i32> undef, i32 %arg, i32 0 |
+ br label %block |
+block: |
+ call void @ForceSpillAndUse(i8* %alloc) |
+ ret <4 x i32> %vec1 |
+; CHECK-LABEL: align_global_vector_ebp_based: |
+; CHECK: movups xmm0, xmmword ptr [ebp-24] |
+; CHECK-NEXT: mov esp, ebp |
+; CHECK-NEXT: pop ebp |
+; CHECK: ret |
+} |
+ |
+define <4 x i32> @align_local_vector_ebp_based(i32 %arg) { |
+entry: |
+ %alloc = alloca i8, i32 1, align 1 |
+ %vec1 = insertelement <4 x i32> undef, i32 %arg, i32 0 |
+ call void @ForceSpillAndUse(i8* %alloc) |
+ ret <4 x i32> %vec1 |
+; CHECK-LABEL: align_local_vector_ebp_based: |
+; CHECK: movups xmm0, xmmword ptr [ebp-24] |
+; CHECK-NEXT: mov esp, ebp |
+; CHECK-NEXT: pop ebp |
+; CHECK: ret |
+} |
+ |
+declare void @ForceSpillAndUse(i8*) |
+ |
+; ERRORS-NOT: ICE translation error |