1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; Make sure this testcase codegens to the sin and cos instructions, not calls
3 ; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | FileCheck %s
4 ; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 | FileCheck %s
6 declare float @sinf(float) readonly
8 declare double @sin(double) readonly
10 declare x86_fp80 @sinl(x86_fp80) readonly
12 define float @test1(float %X) {
15 ; CHECK-NEXT: subl $12, %esp
16 ; CHECK-NEXT: .cfi_def_cfa_offset 16
17 ; CHECK-NEXT: flds {{[0-9]+}}(%esp)
18 ; CHECK-NEXT: fstps (%esp)
19 ; CHECK-NEXT: calll _sinf
20 ; CHECK-NEXT: addl $12, %esp
22 %Y = call float @sinf(float %X) readonly
26 define double @test2(double %X) {
29 ; CHECK-NEXT: subl $12, %esp
30 ; CHECK-NEXT: .cfi_def_cfa_offset 16
31 ; CHECK-NEXT: fldl {{[0-9]+}}(%esp)
32 ; CHECK-NEXT: fstpl (%esp)
33 ; CHECK-NEXT: calll _sin
34 ; CHECK-NEXT: addl $12, %esp
36 %Y = call double @sin(double %X) readonly
40 define x86_fp80 @test3(x86_fp80 %X) {
43 ; CHECK-NEXT: subl $28, %esp
44 ; CHECK-NEXT: .cfi_def_cfa_offset 32
45 ; CHECK-NEXT: fldt {{[0-9]+}}(%esp)
46 ; CHECK-NEXT: fstpt (%esp)
47 ; CHECK-NEXT: calll _sinl
48 ; CHECK-NEXT: addl $28, %esp
50 %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
54 declare float @cosf(float) readonly
56 declare double @cos(double) readonly
58 declare x86_fp80 @cosl(x86_fp80) readonly
61 define float @test4(float %X) {
64 ; CHECK-NEXT: subl $12, %esp
65 ; CHECK-NEXT: .cfi_def_cfa_offset 16
66 ; CHECK-NEXT: flds {{[0-9]+}}(%esp)
67 ; CHECK-NEXT: fstps (%esp)
68 ; CHECK-NEXT: calll _cosf
69 ; CHECK-NEXT: addl $12, %esp
71 %Y = call float @cosf(float %X) readonly
75 define double @test5(double %X) {
78 ; CHECK-NEXT: subl $12, %esp
79 ; CHECK-NEXT: .cfi_def_cfa_offset 16
80 ; CHECK-NEXT: fldl {{[0-9]+}}(%esp)
81 ; CHECK-NEXT: fstpl (%esp)
82 ; CHECK-NEXT: calll _cos
83 ; CHECK-NEXT: addl $12, %esp
85 %Y = call double @cos(double %X) readonly
89 define x86_fp80 @test6(x86_fp80 %X) {
92 ; CHECK-NEXT: subl $28, %esp
93 ; CHECK-NEXT: .cfi_def_cfa_offset 32
94 ; CHECK-NEXT: fldt {{[0-9]+}}(%esp)
95 ; CHECK-NEXT: fstpt (%esp)
96 ; CHECK-NEXT: calll _cosl
97 ; CHECK-NEXT: addl $28, %esp
99 %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly