blob: 13f932982f14cfae5b77e50463c4060ec5067ac9 [file] [log] [blame]
Dale Johannesenfe5293d2007-09-26 21:12:10 +00001; Make sure this testcase codegens to the sin and cos instructions, not calls
Dan Gohmanb7c0b242009-09-11 18:36:27 +00002; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \
Dale Johannesenfe5293d2007-09-26 21:12:10 +00003; RUN: grep sin\$ | count 3
Dan Gohmanb7c0b242009-09-11 18:36:27 +00004; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \
Dale Johannesenfe5293d2007-09-26 21:12:10 +00005; RUN: grep cos\$ | count 3
6
Dale Johannesen1d737422009-09-25 18:15:29 +00007declare float @sinf(float) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +00008
Dale Johannesen1d737422009-09-25 18:15:29 +00009declare double @sin(double) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000010
Dale Johannesen1d737422009-09-25 18:15:29 +000011declare x86_fp80 @sinl(x86_fp80) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000012
13define float @test1(float %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000014 %Y = call float @sinf(float %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000015 ret float %Y
16}
17
18define double @test2(double %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000019 %Y = call double @sin(double %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000020 ret double %Y
21}
22
23define x86_fp80 @test3(x86_fp80 %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000024 %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000025 ret x86_fp80 %Y
26}
27
Dale Johannesen1d737422009-09-25 18:15:29 +000028declare float @cosf(float) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000029
Dale Johannesen1d737422009-09-25 18:15:29 +000030declare double @cos(double) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000031
Dale Johannesen1d737422009-09-25 18:15:29 +000032declare x86_fp80 @cosl(x86_fp80) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000033
34define float @test4(float %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000035 %Y = call float @cosf(float %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000036 ret float %Y
37}
38
39define double @test5(double %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000040 %Y = call double @cos(double %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000041 ret double %Y
42}
43
44define x86_fp80 @test6(x86_fp80 %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000045 %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000046 ret x86_fp80 %Y
47}
48