comparison test/CodeGen/AArch64/arm64-sincos.ll @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents 54457678186b
children c2174574ed3a
comparison
equal deleted inserted replaced
120:1172e4bd9c6f 121:803732b1fca8
1 ; RUN: llc < %s -mtriple=arm64-apple-ios7 | FileCheck %s --check-prefix CHECK-IOS 1 ; RUN: llc < %s -mtriple=arm64-apple-ios7 | FileCheck %s --check-prefix CHECK-IOS
2 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix CHECK-LINUX 2 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix CHECK-LINUX
3 3
4 ; Combine sin / cos into a single call. 4 ; Combine sin / cos into a single call unless they may write errno (as
5 ; captured by readnone attrbiute, controlled by clang -fmath-errno
6 ; setting).
5 ; rdar://12856873 7 ; rdar://12856873
6 8
7 define float @test1(float %x) nounwind { 9 define float @test1(float %x) nounwind {
8 entry: 10 entry:
9 ; CHECK-IOS-LABEL: test1: 11 ; CHECK-IOS-LABEL: test1:
10 ; CHECK-IOS: bl ___sincosf_stret 12 ; CHECK-IOS: bl ___sincosf_stret
11 ; CHECK-IOS: fadd s0, s0, s1 13 ; CHECK-IOS: fadd s0, s0, s1
12 14
13 ; CHECK-LINUX-LABEL: test1: 15 ; CHECK-LINUX-LABEL: test1:
16 ; CHECK-LINUX: bl sincosf
17
18 %call = tail call float @sinf(float %x) readnone
19 %call1 = tail call float @cosf(float %x) readnone
20 %add = fadd float %call, %call1
21 ret float %add
22 }
23
24 define float @test1_errno(float %x) nounwind {
25 entry:
26 ; CHECK-IOS-LABEL: test1_errno:
27 ; CHECK-IOS: bl _sinf
28 ; CHECK-IOS: bl _cosf
29
30 ; CHECK-LINUX-LABEL: test1_errno:
14 ; CHECK-LINUX: bl sinf 31 ; CHECK-LINUX: bl sinf
15 ; CHECK-LINUX: bl cosf 32 ; CHECK-LINUX: bl cosf
16 33
17 %call = tail call float @sinf(float %x) nounwind readnone 34 %call = tail call float @sinf(float %x)
18 %call1 = tail call float @cosf(float %x) nounwind readnone 35 %call1 = tail call float @cosf(float %x)
19 %add = fadd float %call, %call1 36 %add = fadd float %call, %call1
20 ret float %add 37 ret float %add
21 } 38 }
22 39
23 define double @test2(double %x) nounwind { 40 define double @test2(double %x) nounwind {
25 ; CHECK-IOS-LABEL: test2: 42 ; CHECK-IOS-LABEL: test2:
26 ; CHECK-IOS: bl ___sincos_stret 43 ; CHECK-IOS: bl ___sincos_stret
27 ; CHECK-IOS: fadd d0, d0, d1 44 ; CHECK-IOS: fadd d0, d0, d1
28 45
29 ; CHECK-LINUX-LABEL: test2: 46 ; CHECK-LINUX-LABEL: test2:
30 ; CHECK-LINUX: bl sin 47 ; CHECK-LINUX: bl sincos
31 ; CHECK-LINUX: bl cos
32 48
33 %call = tail call double @sin(double %x) nounwind readnone 49 %call = tail call double @sin(double %x) readnone
34 %call1 = tail call double @cos(double %x) nounwind readnone 50 %call1 = tail call double @cos(double %x) readnone
35 %add = fadd double %call, %call1 51 %add = fadd double %call, %call1
36 ret double %add 52 ret double %add
37 } 53 }
38 54
39 declare float @sinf(float) readonly 55 define double @test2_errno(double %x) nounwind {
40 declare double @sin(double) readonly 56 entry:
41 declare float @cosf(float) readonly 57 ; CHECK-IOS-LABEL: test2_errno:
42 declare double @cos(double) readonly 58 ; CHECK-IOS: bl _sin
59 ; CHECK-IOS: bl _cos
60
61 ; CHECK-LINUX-LABEL: test2_errno:
62 ; CHECK-LINUX: bl sin
63 ; CHECK-LINUX: bl cos
64
65 %call = tail call double @sin(double %x)
66 %call1 = tail call double @cos(double %x)
67 %add = fadd double %call, %call1
68 ret double %add
69 }
70
71 declare float @sinf(float)
72 declare double @sin(double)
73 declare float @cosf(float)
74 declare double @cos(double)