xref: /llvm-project/llvm/test/CodeGen/X86/fp-stack-ret-store.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mcpu=yonah | FileCheck %s
3
4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5target triple = "i686-apple-darwin8"
6
7; This should store directly into P from the FP stack.  It should not
8; go through a stack slot to get there.
9
10define void @bar(ptr %P) {
11; CHECK-LABEL: bar:
12; CHECK:       ## %bb.0: ## %entry
13; CHECK-NEXT:    pushl %esi
14; CHECK-NEXT:    .cfi_def_cfa_offset 8
15; CHECK-NEXT:    subl $8, %esp
16; CHECK-NEXT:    .cfi_def_cfa_offset 16
17; CHECK-NEXT:    .cfi_offset %esi, -8
18; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %esi
19; CHECK-NEXT:    calll _foo
20; CHECK-NEXT:    fstpl (%esi)
21; CHECK-NEXT:    addl $8, %esp
22; CHECK-NEXT:    popl %esi
23; CHECK-NEXT:    retl
24entry:
25	%tmp = tail call double (...) @foo( )		; <double> [#uses=1]
26	store double %tmp, ptr %P, align 8
27	ret void
28}
29
30declare double @foo(...)
31
32define void @bar2(ptr %P) {
33; CHECK-LABEL: bar2:
34; CHECK:       ## %bb.0: ## %entry
35; CHECK-NEXT:    pushl %esi
36; CHECK-NEXT:    .cfi_def_cfa_offset 8
37; CHECK-NEXT:    subl $8, %esp
38; CHECK-NEXT:    .cfi_def_cfa_offset 16
39; CHECK-NEXT:    .cfi_offset %esi, -8
40; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %esi
41; CHECK-NEXT:    calll _foo2
42; CHECK-NEXT:    fstps (%esi)
43; CHECK-NEXT:    addl $8, %esp
44; CHECK-NEXT:    popl %esi
45; CHECK-NEXT:    retl
46entry:
47	%tmp = tail call double (...) @foo2( )		; <double> [#uses=1]
48	%tmp1 = fptrunc double %tmp to float		; <float> [#uses=1]
49	store float %tmp1, ptr %P, align 4
50	ret void
51}
52
53declare double @foo2(...)
54
55