blob: 734f48ae329f50942c1b5c131e434c46a1cd31d2 [file] [log] [blame]
Dale Johannesenfe5293d2007-09-26 21:12:10 +00001; Make sure this testcase codegens to the sin and cos instructions, not calls
Bob Wilson5f91a992012-08-08 20:31:37 +00002; 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
Benjamin Kramer562b2402012-09-15 12:44:27 +00004; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 | FileCheck %s --check-prefix=SAFE
Dale Johannesenfe5293d2007-09-26 21:12:10 +00005
Dale Johannesen1d737422009-09-25 18:15:29 +00006declare float @sinf(float) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +00007
Dale Johannesen1d737422009-09-25 18:15:29 +00008declare double @sin(double) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +00009
Dale Johannesen1d737422009-09-25 18:15:29 +000010declare x86_fp80 @sinl(x86_fp80) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000011
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000012; SIN: test1:
Dale Johannesenfe5293d2007-09-26 21:12:10 +000013define 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}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000017; SIN: {{^[ \t]*fsin$}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000018
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000019; SIN-NOT: fsin
20
Benjamin Kramer562b2402012-09-15 12:44:27 +000021; SAFE: test1
22; SAFE-NOT: fsin
23
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000024; SIN: test2:
Dale Johannesenfe5293d2007-09-26 21:12:10 +000025define double @test2(double %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000026 %Y = call double @sin(double %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000027 ret double %Y
28}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000029; SIN: {{^[ \t]*fsin$}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000030
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000031; SIN-NOT: fsin
32
Benjamin Kramer562b2402012-09-15 12:44:27 +000033; SAFE: test2
34; SAFE-NOT: fsin
35
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000036; SIN: test3:
Dale Johannesenfe5293d2007-09-26 21:12:10 +000037define x86_fp80 @test3(x86_fp80 %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000038 %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000039 ret x86_fp80 %Y
40}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000041; SIN: {{^[ \t]*fsin$}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000042
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000043; SIN-NOT: fsin
44; COS-NOT: fcos
Dale Johannesen1d737422009-09-25 18:15:29 +000045declare float @cosf(float) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000046
Dale Johannesen1d737422009-09-25 18:15:29 +000047declare double @cos(double) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000048
Dale Johannesen1d737422009-09-25 18:15:29 +000049declare x86_fp80 @cosl(x86_fp80) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000050
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000051
52; SIN: test4:
53; COS: test3:
Dale Johannesenfe5293d2007-09-26 21:12:10 +000054define float @test4(float %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000055 %Y = call float @cosf(float %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000056 ret float %Y
57}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000058; COS: {{^[ \t]*fcos}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000059
Benjamin Kramer562b2402012-09-15 12:44:27 +000060; SAFE: test4
61; SAFE-NOT: fcos
62
Dale Johannesenfe5293d2007-09-26 21:12:10 +000063define double @test5(double %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000064 %Y = call double @cos(double %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000065 ret double %Y
66}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000067; COS: {{^[ \t]*fcos}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000068
Benjamin Kramer562b2402012-09-15 12:44:27 +000069; SAFE: test5
70; SAFE-NOT: fcos
71
Dale Johannesenfe5293d2007-09-26 21:12:10 +000072define x86_fp80 @test6(x86_fp80 %X) {
Dale Johannesen1d737422009-09-25 18:15:29 +000073 %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly
Dale Johannesenfe5293d2007-09-26 21:12:10 +000074 ret x86_fp80 %Y
75}
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000076; COS: {{^[ \t]*fcos}}
Dale Johannesenfe5293d2007-09-26 21:12:10 +000077
NAKAMURA Takumiea957f02012-07-03 03:59:22 +000078; SIN-NOT: fsin
79; COS-NOT: fcos