summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-07-23 12:23:45 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-07-23 12:23:45 +0000
commit454d14539597986d2cf4a50dbebf894081392f04 (patch)
tree971d3932c03aced4d388d7a2e117cdcbfeee6d4e /llvm/test
parentf6a58b6dff6dc0d585d6ab08c2abd0a309ea4aea (diff)
downloadbcm5719-llvm-454d14539597986d2cf4a50dbebf894081392f04.tar.gz
bcm5719-llvm-454d14539597986d2cf4a50dbebf894081392f04.zip
[X86] Allow load folding into PUSH instructions
Adds pushes to the folding tables. This also required a fix to the TD definition, since the memory forms of the push instructions did not have the right mayLoad/mayStore flags. Differential Revision: http://reviews.llvm.org/D11340 llvm-svn: 243010
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/fold-push.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fold-push.ll b/llvm/test/CodeGen/X86/fold-push.ll
new file mode 100644
index 00000000000..f5f33321c13
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fold-push.ll
@@ -0,0 +1,40 @@
+; RUN: llc < %s -mtriple=i686-windows | FileCheck %s -check-prefix=CHECK -check-prefix=NORMAL
+; RUN: llc < %s -mtriple=i686-windows -mattr=call-reg-indirect | FileCheck %s -check-prefix=CHECK -check-prefix=SLM
+
+declare void @foo(i32 %r)
+
+define void @test(i32 %a, i32 %b) optsize {
+; CHECK-LABEL: test:
+; CHECK: movl [[EAX:%e..]], (%esp)
+; CHECK-NEXT: pushl [[EAX]]
+; CHECK-NEXT: calll
+; CHECK-NEXT: addl $4, %esp
+; CHECK: nop
+; NORMAL: pushl (%esp)
+; SLM: movl (%esp), [[RELOAD:%e..]]
+; SLM-NEXT: pushl [[RELOAD]]
+; CHECK: calll
+; CHECK-NEXT: addl $4, %esp
+ %c = add i32 %a, %b
+ call void @foo(i32 %c)
+ call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di}"()
+ call void @foo(i32 %c)
+ ret void
+}
+
+define void @test_min(i32 %a, i32 %b) minsize {
+; CHECK-LABEL: test_min:
+; CHECK: movl [[EAX:%e..]], (%esp)
+; CHECK-NEXT: pushl [[EAX]]
+; CHECK-NEXT: calll
+; CHECK-NEXT: addl $4, %esp
+; CHECK: nop
+; CHECK: pushl (%esp)
+; CHECK: calll
+; CHECK-NEXT: addl $4, %esp
+ %c = add i32 %a, %b
+ call void @foo(i32 %c)
+ call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di}"()
+ call void @foo(i32 %c)
+ ret void
+}
OpenPOWER on IntegriCloud