summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2011-06-06 23:15:58 +0000
committerStuart Hastings <stuart@apple.com>2011-06-06 23:15:58 +0000
commitf99a4b82a4ff0383138ccaf9e22511eb786168fb (patch)
treec305a8d3332fa53297c08a9de7ad965995afc4e5 /test
parentbe2d1239a40db5efd25e3f306ae15390d9db35c6 (diff)
downloadllvm-f99a4b82a4ff0383138ccaf9e22511eb786168fb.tar.gz
llvm-f99a4b82a4ff0383138ccaf9e22511eb786168fb.tar.bz2
llvm-f99a4b82a4ff0383138ccaf9e22511eb786168fb.tar.xz
Followup to 132458, omit unnecessary stack copy when x87 input is a
load. rdar://problem/6373334 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/2011-06-03-x87chain.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2011-06-03-x87chain.ll b/test/CodeGen/X86/2011-06-03-x87chain.ll
new file mode 100644
index 0000000000..19b4fc734c
--- /dev/null
+++ b/test/CodeGen/X86/2011-06-03-x87chain.ll
@@ -0,0 +1,31 @@
+; RUN: llc < %s -march=x86 | FileCheck %s
+
+define float @chainfail1(i64* nocapture %a, i64* nocapture %b, i32 %x, i32 %y, float* nocapture %f) nounwind uwtable noinline ssp {
+entry:
+ %tmp1 = load i64* %a, align 8
+; Insure x87 ops are properly chained, order preserved.
+; CHECK: fildll
+ %conv = sitofp i64 %tmp1 to float
+; CHECK: fstps
+ store float %conv, float* %f, align 4
+; CHECK: idivl
+ %div = sdiv i32 %x, %y
+ %conv5 = sext i32 %div to i64
+ store i64 %conv5, i64* %b, align 8
+ ret float %conv
+}
+
+define float @chainfail2(i64* nocapture %a, i64* nocapture %b, i32 %x, i32 %y, float* nocapture %f) nounwind uwtable noinline ssp {
+entry:
+; CHECK: movl $0,
+ store i64 0, i64* %b, align 8
+ %mul = mul nsw i32 %y, %x
+ %sub = add nsw i32 %mul, -1
+ %idxprom = sext i32 %sub to i64
+ %arrayidx = getelementptr inbounds i64* %a, i64 %idxprom
+ %tmp4 = load i64* %arrayidx, align 8
+; CHECK: fildll
+ %conv = sitofp i64 %tmp4 to float
+ store float %conv, float* %f, align 4
+ ret float %conv
+}