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 WORD $0xED201000 //cdb %f2,0(%r1)
53 BYTE $0x00
54 BYTE $0x19
55 BGE L11
56 BVS L11
57 MOVD $·tanxadd<>+0(SB), R1
58 FMOVD 88(R5), F6
59 FMOVD 0(R1), F4
60 WFMSDB V0, V6, V4, V6
61 FMOVD 80(R5), F1
62 FADD F6, F4
63 FMOVD 72(R5), F2
64 FMSUB F1, F4, F0
65 FMOVD 64(R5), F3
66 WFMADB V4, V2, V0, V2
67 FMOVD 56(R5), F1
68 WFMADB V4, V3, V2, V4
69 FMUL F2, F2
70 VLEG $0, 48(R5), V18
71 LGDR F6, R1
72 FMOVD 40(R5), F5
73 FMOVD 32(R5), F3
74 FMADD F1, F2, F3
75 FMOVD 24(R5), F1
76 FMOVD 16(R5), F7
77 FMOVD 8(R5), F0
78 WFMADB V2, V7, V1, V7
79 WFMADB V2, V0, V5, V0
80 WFMDB V2, V2, V1
81 FMOVD 0(R5), F5
82 WFLCDB V4, V16
83 WFMADB V2, V5, V18, V5
84 WFMADB V1, V0, V7, V0
85 TMLL R1, $1
86 WFMADB V1, V5, V3, V1
87 BNE L12
88 WFDDB V0, V1, V0
89 WFMDB V2, V16, V2
90 WFMADB V2, V0, V4, V0
91 WORD $0xB3130000 //lcdbr %f0,%f0
92 FMOVD F0, ret+8(FP)
93 RET
94 L12:
95 WFMSDB V2, V1, V0, V2
96 WFMDB V16, V2, V2
97 FDIV F2, F0
98 FMOVD F0, ret+8(FP)
99 RET
100 L11:
101 MOVD $·tanxnan<>+0(SB), R1
102 FMOVD 0(R1), F0
103 FMOVD F0, ret+8(FP)
104 RET
105 L10:
106 WORD $0xB3130020 //lcdbr %f2,%f0
107 BR L2
108 atanIsZero:
109 FMOVD F0, ret+8(FP)
110 RET
111
View as plain text