Text file
src/math/tan_s390x.s
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "textflag.h"
6
7 // Minimax polynomial approximations
8 DATA ·tanrodataL13<> + 0(SB)/8, $0.181017336383229927e-07
9 DATA ·tanrodataL13<> + 8(SB)/8, $-.256590857271311164e-03
10 DATA ·tanrodataL13<> + 16(SB)/8, $-.464359274328689195e+00
11 DATA ·tanrodataL13<> + 24(SB)/8, $1.0
12 DATA ·tanrodataL13<> + 32(SB)/8, $-.333333333333333464e+00
13 DATA ·tanrodataL13<> + 40(SB)/8, $0.245751217306830032e-01
14 DATA ·tanrodataL13<> + 48(SB)/8, $-.245391301343844510e-03
15 DATA ·tanrodataL13<> + 56(SB)/8, $0.214530914428992319e-01
16 DATA ·tanrodataL13<> + 64(SB)/8, $0.108285667160535624e-31
17 DATA ·tanrodataL13<> + 72(SB)/8, $0.612323399573676480e-16
18 DATA ·tanrodataL13<> + 80(SB)/8, $0.157079632679489656e+01
19 DATA ·tanrodataL13<> + 88(SB)/8, $0.636619772367581341e+00
20 GLOBL ·tanrodataL13<> + 0(SB), RODATA, $96
21
22 // Constants
23 DATA ·tanxnan<> + 0(SB)/8, $0x7ff8000000000000
24 GLOBL ·tanxnan<> + 0(SB), RODATA, $8
25 DATA ·tanxlim<> + 0(SB)/8, $0x432921fb54442d19
26 GLOBL ·tanxlim<> + 0(SB), RODATA, $8
27 DATA ·tanxadd<> + 0(SB)/8, $0xc338000000000000
28 GLOBL ·tanxadd<> + 0(SB), RODATA, $8
29
30 // Tan returns the tangent of the radian argument.
31 //
32 // Special cases are:
33 // Tan(±0) = ±0
34 // Tan(±Inf) = NaN
35 // Tan(NaN) = NaN
36 // The algorithm used is minimax polynomial approximation using a table of
37 // polynomial coefficients determined with a Remez exchange algorithm.
38
39 TEXT ·tanAsm(SB), NOSPLIT, $0-16
40 FMOVD x+0(FP), F0
41 //special case Tan(±0) = ±0
42 FMOVD $(0.0), F1
43 FCMPU F0, F1
44 BEQ atanIsZero
45
46 MOVD $·tanrodataL13<>+0(SB), R5
47 LTDBR F0, F0
48 BLTU L10
49 FMOVD F0, F2
50 L2:
51 MOVD $·tanxlim<>+0(SB), R1
52 FMOVD 0(R1), F1
53 FCMPU F2, F1
54 BGT L9
55 BVS L11
56 MOVD $·tanxadd<>+0(SB), R1
57 FMOVD 88(R5), F6
58 FMOVD 0(R1), F4
59 WFMSDB V0, V6, V4, V6
60 FMOVD 80(R5), F1
61 FADD F6, F4
62 FMOVD 72(R5), F2
63 FMSUB F1, F4, F0
64 FMOVD 64(R5), F3
65 WFMADB V4, V2, V0, V2
66 FMOVD 56(R5), F1
67 WFMADB V4, V3, V2, V4
68 FMUL F2, F2
69 VLEG $0, 48(R5), V18
70 LGDR F6, R1
71 FMOVD 40(R5), F5
72 FMOVD 32(R5), F3
73 FMADD F1, F2, F3
74 FMOVD 24(R5), F1
75 FMOVD 16(R5), F7
76 FMOVD 8(R5), F0
77 WFMADB V2, V7, V1, V7
78 WFMADB V2, V0, V5, V0
79 WFMDB V2, V2, V1
80 FMOVD 0(R5), F5
81 WFLCDB V4, V16
82 WFMADB V2, V5, V18, V5
83 WFMADB V1, V0, V7, V0
84 TMLL R1, $1
85 WFMADB V1, V5, V3, V1
86 BNE L12
87 WFDDB V0, V1, V0
88 WFMDB V2, V16, V2
89 WFMADB V2, V0, V4, V0
90 WORD $0xB3130000 //lcdbr %f0,%f0
91 FMOVD F0, ret+8(FP)
92 RET
93 L12:
94 WFMSDB V2, V1, V0, V2
95 WFMDB V16, V2, V2
96 FDIV F2, F0
97 FMOVD F0, ret+8(FP)
98 RET
99 L11:
100 MOVD $·tanxnan<>+0(SB), R1
101 FMOVD 0(R1), F0
102 FMOVD F0, ret+8(FP)
103 RET
104 L10:
105 WORD $0xB3130020 //lcdbr %f2,%f0
106 BR L2
107 L9:
108 BR ·tan(SB)
109 atanIsZero:
110 FMOVD F0, ret+8(FP)
111 RET
112
View as plain text