summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/2010-07-02-asm-alignstack.ll
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-07-02 20:16:09 +0000
committerDale Johannesen <dalej@apple.com>2010-07-02 20:16:09 +0000
commitf1e309eb4862459a76445942ba4dafc433b6f317 (patch)
tree9ffe14cb16d9826246eabf37e3a126065183256f /test/CodeGen/X86/2010-07-02-asm-alignstack.ll
parent6bae55017c49e59746a65cef2513f031bbcebfce (diff)
downloadllvm-f1e309eb4862459a76445942ba4dafc433b6f317.tar.gz
llvm-f1e309eb4862459a76445942ba4dafc433b6f317.tar.bz2
llvm-f1e309eb4862459a76445942ba4dafc433b6f317.tar.xz
Propagate the AlignStack bit in InlineAsm's to the
PrologEpilog code, and use it to determine whether the asm forces stack alignment or not. gcc consistently does not do this for GCC-style asms; Apple gcc inconsistently sometimes does it for asm blocks. There is no convenient place to put a bit in either the SDNode or the MachineInstr form, so I've added an extra operand to each; unlovely, but it does allow for expansion for more bits, should we need it. PR 5125. Some existing testcases are affected. The operand lists of the SDNode and MachineInstr forms are indexed with awesome mnemonics, like "2"; I may fix this someday, but not now. I'm not making it any worse. If anyone is inspired I think you can find all the right places from this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2010-07-02-asm-alignstack.ll')
-rw-r--r--test/CodeGen/X86/2010-07-02-asm-alignstack.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2010-07-02-asm-alignstack.ll b/test/CodeGen/X86/2010-07-02-asm-alignstack.ll
new file mode 100644
index 0000000000..cb47d208dd
--- /dev/null
+++ b/test/CodeGen/X86/2010-07-02-asm-alignstack.ll
@@ -0,0 +1,31 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
+
+define void @foo() nounwind ssp {
+entry:
+; CHECK: foo
+; CHECK: subq $8, %rsp
+; CHECK: int $3
+ call void asm sideeffect alignstack "# top of block", "~{dirflag},~{fpsr},~{flags},~{edi},~{esi},~{edx},~{ecx},~{eax}"() nounwind
+ call void asm sideeffect alignstack ".file \22small.c\22", "~{dirflag},~{fpsr},~{flags}"() nounwind
+ call void asm sideeffect alignstack ".line 3", "~{dirflag},~{fpsr},~{flags}"() nounwind
+ call void asm sideeffect alignstack "int $$3", "~{dirflag},~{fpsr},~{flags},~{memory}"() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @bar() nounwind ssp {
+entry:
+; CHECK: bar
+; CHECK-NOT: subq $8, %rsp
+; CHECK: int $3
+ call void asm sideeffect "# top of block", "~{dirflag},~{fpsr},~{flags},~{edi},~{esi},~{edx},~{ecx},~{eax}"() nounwind
+ call void asm sideeffect ".file \22small.c\22", "~{dirflag},~{fpsr},~{flags}"() nounwind
+ call void asm sideeffect ".line 3", "~{dirflag},~{fpsr},~{flags}"() nounwind
+ call void asm sideeffect "int $$3", "~{dirflag},~{fpsr},~{flags},~{memory}"() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}