summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/sincos.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/ARM/sincos.ll')
-rw-r--r--test/CodeGen/ARM/sincos.ll67
1 files changed, 51 insertions, 16 deletions
diff --git a/test/CodeGen/ARM/sincos.ll b/test/CodeGen/ARM/sincos.ll
index 5be0044ddbd3..42a834d24b3e 100644
--- a/test/CodeGen/ARM/sincos.ll
+++ b/test/CodeGen/ARM/sincos.ll
@@ -1,10 +1,12 @@
; RUN: llc < %s -mtriple=armv7-apple-ios6 -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT
; RUN: llc < %s -mtriple=armv7-apple-ios7 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS
-; RUN: llc < %s -mtriple=armv7-linux-gnu -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT-GNU
+; RUN: llc < %s -mtriple=armv7-linux-gnu -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a8 \
; RUN: --enable-unsafe-fp-math | FileCheck %s --check-prefix=SINCOS-GNU
-; Combine sin / cos into a single call.
+; Combine sin / cos into a single call unless they may write errno (as
+; captured by readnone attrbiute, controlled by clang -fmath-errno
+; setting).
; rdar://12856873
define float @test1(float %x) nounwind {
@@ -19,12 +21,28 @@ entry:
; NOOPT: bl _sinf
; NOOPT: bl _cosf
-; NOOPT-GNU-LABEL: test1:
-; NOOPT-GNU: bl sinf
-; NOOPT-GNU: bl cosf
+ %call = tail call float @sinf(float %x) readnone
+ %call1 = tail call float @cosf(float %x) readnone
+ %add = fadd float %call, %call1
+ ret float %add
+}
+
+define float @test1_errno(float %x) nounwind {
+entry:
+; SINCOS-LABEL: test1_errno:
+; SINCOS: bl _sinf
+; SINCOS: bl _cosf
- %call = tail call float @sinf(float %x) nounwind readnone
- %call1 = tail call float @cosf(float %x) nounwind readnone
+; SINCOS-GNU-LABEL: test1_errno:
+; SINCOS-GNU: bl sinf
+; SINCOS-GNU: bl cosf
+
+; NOOPT-LABEL: test1_errno:
+; NOOPT: bl _sinf
+; NOOPT: bl _cosf
+
+ %call = tail call float @sinf(float %x)
+ %call1 = tail call float @cosf(float %x)
%add = fadd float %call, %call1
ret float %add
}
@@ -41,16 +59,33 @@ entry:
; NOOPT: bl _sin
; NOOPT: bl _cos
-; NOOPT-GNU-LABEL: test2:
-; NOOPT-GNU: bl sin
-; NOOPT-GNU: bl cos
- %call = tail call double @sin(double %x) nounwind readnone
- %call1 = tail call double @cos(double %x) nounwind readnone
+ %call = tail call double @sin(double %x) readnone
+ %call1 = tail call double @cos(double %x) readnone
+ %add = fadd double %call, %call1
+ ret double %add
+}
+
+define double @test2_errno(double %x) nounwind {
+entry:
+; SINCOS-LABEL: test2_errno:
+; SINCOS: bl _sin
+; SINCOS: bl _cos
+
+; SINCOS-GNU-LABEL: test2_errno:
+; SINCOS-GNU: bl sin
+; SINCOS-GNU: bl cos
+
+; NOOPT-LABEL: test2_errno:
+; NOOPT: bl _sin
+; NOOPT: bl _cos
+
+ %call = tail call double @sin(double %x)
+ %call1 = tail call double @cos(double %x)
%add = fadd double %call, %call1
ret double %add
}
-declare float @sinf(float) readonly
-declare double @sin(double) readonly
-declare float @cosf(float) readonly
-declare double @cos(double) readonly
+declare float @sinf(float)
+declare double @sin(double)
+declare float @cosf(float)
+declare double @cos(double)