• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Make sure this testcase codegens to the sin and cos instructions, not calls
2; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math  | FileCheck %s --check-prefix=SIN
3; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math  | FileCheck %s --check-prefix=COS
4; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=SAFE
5
6declare float  @sinf(float) readonly
7
8declare double @sin(double) readonly
9
10declare x86_fp80 @sinl(x86_fp80) readonly
11
12; SIN-LABEL: test1:
13define float @test1(float %X) {
14        %Y = call float @sinf(float %X) readonly
15        ret float %Y
16}
17; SIN: {{^[ \t]*fsin$}}
18
19; SIN-NOT: fsin
20
21; SAFE: test1
22; SAFE-NOT: fsin
23
24; SIN-LABEL: test2:
25define double @test2(double %X) {
26        %Y = call double @sin(double %X) readonly
27        ret double %Y
28}
29; SIN: {{^[ \t]*fsin$}}
30
31; SIN-NOT: fsin
32
33; SAFE: test2
34; SAFE-NOT: fsin
35
36; SIN-LABEL: test3:
37define x86_fp80 @test3(x86_fp80 %X) {
38        %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
39        ret x86_fp80 %Y
40}
41; SIN: {{^[ \t]*fsin$}}
42
43; SIN-NOT: fsin
44; COS-NOT: fcos
45declare float @cosf(float) readonly
46
47declare double @cos(double) readonly
48
49declare x86_fp80 @cosl(x86_fp80) readonly
50
51
52; SIN-LABEL: test4:
53; COS-LABEL: test3:
54define float @test4(float %X) {
55        %Y = call float @cosf(float %X) readonly
56        ret float %Y
57}
58; COS: {{^[ \t]*fcos}}
59
60; SAFE: test4
61; SAFE-NOT: fcos
62
63define double @test5(double %X) {
64        %Y = call double @cos(double %X) readonly
65        ret double %Y
66}
67; COS: {{^[ \t]*fcos}}
68
69; SAFE: test5
70; SAFE-NOT: fcos
71
72define x86_fp80 @test6(x86_fp80 %X) {
73        %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly
74        ret x86_fp80 %Y
75}
76; COS: {{^[ \t]*fcos}}
77
78; SIN-NOT: fsin
79; COS-NOT: fcos
80