1; RUN: llc < %s -mtriple=x86_64-apple-macosx10.9.0 -mcpu=core2 | FileCheck %s --check-prefix=OSX_SINCOS 2; RUN: llc < %s -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core2 | FileCheck %s --check-prefix=OSX_NOOPT 3; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -mcpu=core2 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GNU_SINCOS 4 5; Combine sin / cos into a single call. 6; rdar://13087969 7; rdar://13599493 8 9define float @test1(float %x) nounwind { 10entry: 11; GNU_SINCOS-LABEL: test1: 12; GNU_SINCOS: callq sincosf 13; GNU_SINCOS: movss 4(%rsp), %xmm0 14; GNU_SINCOS: addss (%rsp), %xmm0 15 16; OSX_SINCOS-LABEL: test1: 17; OSX_SINCOS: callq ___sincosf_stret 18; OSX_SINCOS: movaps %xmm0, %xmm1 19; OSX_SINCOS: shufps {{.*}} ## xmm1 = xmm1[1,1,2,3] 20; OSX_SINCOS: addss %xmm0, %xmm1 21 22; OSX_NOOPT: test1 23; OSX_NOOPT: callq _sinf 24; OSX_NOOPT: callq _cosf 25 %call = tail call float @sinf(float %x) nounwind readnone 26 %call1 = tail call float @cosf(float %x) nounwind readnone 27 %add = fadd float %call, %call1 28 ret float %add 29} 30 31define double @test2(double %x) nounwind { 32entry: 33; GNU_SINCOS-LABEL: test2: 34; GNU_SINCOS: callq sincos 35; GNU_SINCOS: movsd 16(%rsp), %xmm0 36; GNU_SINCOS: addsd 8(%rsp), %xmm0 37 38; OSX_SINCOS-LABEL: test2: 39; OSX_SINCOS: callq ___sincos_stret 40; OSX_SINCOS: addsd %xmm1, %xmm0 41 42; OSX_NOOPT: test2 43; OSX_NOOPT: callq _sin 44; OSX_NOOPT: callq _cos 45 %call = tail call double @sin(double %x) nounwind readnone 46 %call1 = tail call double @cos(double %x) nounwind readnone 47 %add = fadd double %call, %call1 48 ret double %add 49} 50 51define x86_fp80 @test3(x86_fp80 %x) nounwind { 52entry: 53; GNU_SINCOS-LABEL: test3: 54; GNU_SINCOS: callq sinl 55; GNU_SINCOS: callq cosl 56; GNU_SINCOS: ret 57 %call = tail call x86_fp80 @sinl(x86_fp80 %x) nounwind 58 %call1 = tail call x86_fp80 @cosl(x86_fp80 %x) nounwind 59 %add = fadd x86_fp80 %call, %call1 60 ret x86_fp80 %add 61} 62 63declare float @sinf(float) readonly 64declare double @sin(double) readonly 65declare float @cosf(float) readonly 66declare double @cos(double) readonly 67 68declare x86_fp80 @sinl(x86_fp80) 69declare x86_fp80 @cosl(x86_fp80) 70