xref: /llvm-project/llvm/test/CodeGen/X86/pr1505b.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mcpu=i486 | FileCheck %s
2; PR1505
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"
5target triple = "i686-apple-darwin8"
6	%"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
7	%"struct.std::basic_ostream<char,std::char_traits<char> >" = type { ptr, %"struct.std::basic_ios<char,std::char_traits<char> >" }
8	%"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"struct.std::locale" }
9	%"struct.std::ctype<char>" = type { %"struct.std::locale::facet", ptr, i8, ptr, ptr, ptr, i8, [256 x i8], [256 x i8], i8 }
10	%"struct.std::ctype_base" = type <{ i8 }>
11	%"struct.std::ios_base" = type { ptr, i32, i32, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"struct.std::locale" }
12	%"struct.std::ios_base::_Callback_list" = type { ptr, ptr, i32, i32 }
13	%"struct.std::ios_base::_Words" = type { ptr, i32 }
14	%"struct.std::locale" = type { ptr }
15	%"struct.std::locale::_Impl" = type { i32, ptr, i32, ptr, ptr }
16	%"struct.std::locale::facet" = type { ptr, i32 }
17	%"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
18@a = global float 0x3FD3333340000000		; <ptr> [#uses=1]
19@b = global double 6.000000e-01, align 8		; <ptr> [#uses=1]
20@_ZSt8__ioinit = internal global %"struct.std::ctype_base" zeroinitializer		; <ptr> [#uses=2]
21@__dso_handle = external global ptr		; <ptr> [#uses=1]
22@_ZSt4cout = external global %"struct.std::basic_ostream<char,std::char_traits<char> >"		; <ptr> [#uses=2]
23@.str = internal constant [12 x i8] c"tan float: \00"		; <ptr> [#uses=1]
24@.str1 = internal constant [13 x i8] c"tan double: \00"		; <ptr> [#uses=1]
25
26declare void @_ZNSt8ios_base4InitD1Ev(ptr)
27
28declare void @_ZNSt8ios_base4InitC1Ev(ptr)
29
30declare i32 @__cxa_atexit(ptr, ptr, ptr)
31
32; CHECK: main
33define i32 @main() {
34entry:
35; CHECK: flds
36	%tmp6 = load volatile float, ptr @a		; <float> [#uses=1]
37; CHECK: fstps (%esp)
38; CHECK: tanf
39	%tmp9 = tail call float @tanf( float %tmp6 )		; <float> [#uses=1]
40; Spill returned value:
41; CHECK: fstp
42
43; CHECK: fldl
44	%tmp12 = load volatile double, ptr @b		; <double> [#uses=1]
45; CHECK: fstpl (%esp)
46; CHECK: tan
47	%tmp13 = tail call double @tan( double %tmp12 )		; <double> [#uses=1]
48; Spill returned value:
49; CHECK: fstp
50	%tmp1314 = fptrunc double %tmp13 to float		; <float> [#uses=1]
51	%tmp16 = tail call ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( ptr @_ZSt4cout, ptr @.str )		; <ptr> [#uses=1]
52	%tmp1920 = fpext float %tmp9 to double		; <double> [#uses=1]
53; reload:
54; CHECK: fld
55; CHECK: fstpl
56; CHECK: ZNSolsEd
57	%tmp22 = tail call ptr @_ZNSolsEd( ptr %tmp16, double %tmp1920 )		; <ptr> [#uses=1]
58	%tmp30 = tail call ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_( ptr %tmp22 )		; <ptr> [#uses=0]
59; reload:
60; CHECK: ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
61	%tmp34 = tail call ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( ptr @_ZSt4cout, ptr @.str1 )		; <ptr> [#uses=1]
62	%tmp3940 = fpext float %tmp1314 to double		; <double> [#uses=1]
63; CHECK: fld
64; CHECK: fstpl
65; CHECK: ZNSolsEd
66	%tmp42 = tail call ptr @_ZNSolsEd( ptr %tmp34, double %tmp3940 )		; <ptr> [#uses=1]
67	%tmp51 = tail call ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_( ptr %tmp42 )		; <ptr> [#uses=0]
68	ret i32 0
69}
70
71declare float @tanf(float)
72
73declare double @tan(double)
74
75declare ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr, ptr)
76
77declare ptr @_ZNSolsEd(ptr, double)
78
79declare ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr)
80