128 lines · plain
1; RUN: llc < %s -mtriple=armv7-apple-ios6 -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT2; RUN: llc < %s -mtriple=armv7-apple-ios7 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS3; RUN: llc < %s -mtriple=armv7-linux-gnu -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU4; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU5; RUN: llc < %s -mtriple=armv7-linux-android -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU6 7; Combine sin / cos into a single call unless they may write errno (as8; captured by readnone attrbiute, controlled by clang -fmath-errno9; setting).10; rdar://1285687311 12define float @test1(float %x) nounwind {13entry:14; SINCOS-LABEL: test1:15; SINCOS: bl ___sincosf_stret16 17; SINCOS-GNU-LABEL: test1:18; SINCOS-GNU: bl sincosf19 20; NOOPT-LABEL: test1:21; NOOPT: bl _sinf22; NOOPT: bl _cosf23 24 %call = tail call float @sinf(float %x) readnone25 %call1 = tail call float @cosf(float %x) readnone26 %add = fadd float %call, %call127 ret float %add28}29 30define float @test1_fast(float %x) nounwind {31entry:32; SINCOS-LABEL: test1_fast:33; SINCOS: bl ___sincosf_stret34 35; SINCOS-GNU-LABEL: test1_fast:36; SINCOS-GNU: bl sincosf37 38; NOOPT-LABEL: test1_fast:39; NOOPT: bl _sinf40; NOOPT: bl _cosf41 42 %call = tail call fast float @sinf(float %x) readnone43 %call1 = tail call fast float @cosf(float %x) readnone44 %add = fadd float %call, %call145 ret float %add46}47 48define float @test1_errno(float %x) nounwind {49entry:50; SINCOS-LABEL: test1_errno:51; SINCOS: bl _sinf52; SINCOS: bl _cosf53 54; SINCOS-GNU-LABEL: test1_errno:55; SINCOS-GNU: bl sinf56; SINCOS-GNU: bl cosf57 58; NOOPT-LABEL: test1_errno:59; NOOPT: bl _sinf60; NOOPT: bl _cosf61 62 %call = tail call float @sinf(float %x)63 %call1 = tail call float @cosf(float %x)64 %add = fadd float %call, %call165 ret float %add66}67 68define double @test2(double %x) nounwind {69entry:70; SINCOS-LABEL: test2:71; SINCOS: bl ___sincos_stret72 73; SINCOS-GNU-LABEL: test2:74; SINCOS-GNU: bl sincos75 76; NOOPT-LABEL: test2:77; NOOPT: bl _sin78; NOOPT: bl _cos79 80 %call = tail call double @sin(double %x) readnone81 %call1 = tail call double @cos(double %x) readnone82 %add = fadd double %call, %call183 ret double %add84}85 86define double @test2_fast(double %x) nounwind {87entry:88; SINCOS-LABEL: test2_fast:89; SINCOS: bl ___sincos_stret90 91; SINCOS-GNU-LABEL: test2_fast:92; SINCOS-GNU: bl sincos93 94; NOOPT-LABEL: test2_fast:95; NOOPT: bl _sin96; NOOPT: bl _cos97 98 %call = tail call fast double @sin(double %x) readnone99 %call1 = tail call fast double @cos(double %x) readnone100 %add = fadd double %call, %call1101 ret double %add102}103 104define double @test2_errno(double %x) nounwind {105entry:106; SINCOS-LABEL: test2_errno:107; SINCOS: bl _sin108; SINCOS: bl _cos109 110; SINCOS-GNU-LABEL: test2_errno:111; SINCOS-GNU: bl sin112; SINCOS-GNU: bl cos113 114; NOOPT-LABEL: test2_errno:115; NOOPT: bl _sin116; NOOPT: bl _cos117 118 %call = tail call double @sin(double %x)119 %call1 = tail call double @cos(double %x)120 %add = fadd double %call, %call1121 ret double %add122}123 124declare float @sinf(float)125declare double @sin(double)126declare float @cosf(float)127declare double @cos(double)128