• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 --check-prefix=CHECK --check-prefix=UNSAFE
4; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE
5
6declare float  @sinf(float) readonly
7
8declare double @sin(double) readonly
9
10declare x86_fp80 @sinl(x86_fp80) readonly
11
12define float @test1(float %X) {
13; CHECK-LABEL: test1:
14; CHECK:       ## %bb.0:
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
21; CHECK-NEXT:    retl
22        %Y = call float @sinf(float %X) readonly
23        ret float %Y
24}
25
26define double @test2(double %X) {
27; CHECK-LABEL: test2:
28; CHECK:       ## %bb.0:
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
35; CHECK-NEXT:    retl
36        %Y = call double @sin(double %X) readonly
37        ret double %Y
38}
39
40define x86_fp80 @test3(x86_fp80 %X) {
41; CHECK-LABEL: test3:
42; CHECK:       ## %bb.0:
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
49; CHECK-NEXT:    retl
50        %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
51        ret x86_fp80 %Y
52}
53
54declare float @cosf(float) readonly
55
56declare double @cos(double) readonly
57
58declare x86_fp80 @cosl(x86_fp80) readonly
59
60
61define float @test4(float %X) {
62; CHECK-LABEL: test4:
63; CHECK:       ## %bb.0:
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
70; CHECK-NEXT:    retl
71        %Y = call float @cosf(float %X) readonly
72        ret float %Y
73}
74
75define double @test5(double %X) {
76; CHECK-LABEL: test5:
77; CHECK:       ## %bb.0:
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
84; CHECK-NEXT:    retl
85        %Y = call double @cos(double %X) readonly
86        ret double %Y
87}
88
89define x86_fp80 @test6(x86_fp80 %X) {
90; CHECK-LABEL: test6:
91; CHECK:       ## %bb.0:
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
98; CHECK-NEXT:    retl
99        %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly
100        ret x86_fp80 %Y
101}
102