Text file
src/math/atanh_s390x.s
Documentation: math
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 coefficients and other constants
8DATA ·atanhrodataL10<> + 0(SB)/8, $.41375273347623353626
9DATA ·atanhrodataL10<> + 8(SB)/8, $.51487302528619766235E+04
10DATA ·atanhrodataL10<> + 16(SB)/8, $-1.67526912689208984375
11DATA ·atanhrodataL10<> + 24(SB)/8, $0.181818181818181826E+00
12DATA ·atanhrodataL10<> + 32(SB)/8, $-.165289256198351540E-01
13DATA ·atanhrodataL10<> + 40(SB)/8, $0.200350613573012186E-02
14DATA ·atanhrodataL10<> + 48(SB)/8, $0.397389654305194527E-04
15DATA ·atanhrodataL10<> + 56(SB)/8, $-.273205381970859341E-03
16DATA ·atanhrodataL10<> + 64(SB)/8, $0.938370938292558173E-06
17DATA ·atanhrodataL10<> + 72(SB)/8, $-.148682720127920854E-06
18DATA ·atanhrodataL10<> + 80(SB)/8, $ 0.212881813645679599E-07
19DATA ·atanhrodataL10<> + 88(SB)/8, $-.602107458843052029E-05
20DATA ·atanhrodataL10<> + 96(SB)/8, $-5.5
21DATA ·atanhrodataL10<> + 104(SB)/8, $-0.5
22DATA ·atanhrodataL10<> + 112(SB)/8, $0.0
23DATA ·atanhrodataL10<> + 120(SB)/8, $0x7ff8000000000000 //Nan
24DATA ·atanhrodataL10<> + 128(SB)/8, $-1.0
25DATA ·atanhrodataL10<> + 136(SB)/8, $1.0
26DATA ·atanhrodataL10<> + 144(SB)/8, $1.0E-20
27GLOBL ·atanhrodataL10<> + 0(SB), RODATA, $152
28
29// Table of log correction terms
30DATA ·atanhtab2076<> + 0(SB)/8, $0.585235384085551248E-01
31DATA ·atanhtab2076<> + 8(SB)/8, $0.412206153771168640E-01
32DATA ·atanhtab2076<> + 16(SB)/8, $0.273839003221648339E-01
33DATA ·atanhtab2076<> + 24(SB)/8, $0.166383778368856480E-01
34DATA ·atanhtab2076<> + 32(SB)/8, $0.866678223433169637E-02
35DATA ·atanhtab2076<> + 40(SB)/8, $0.319831684989627514E-02
36DATA ·atanhtab2076<> + 48(SB)/8, $0.000000000000000000E+00
37DATA ·atanhtab2076<> + 56(SB)/8, $-.113006378583725549E-02
38DATA ·atanhtab2076<> + 64(SB)/8, $-.367979419636602491E-03
39DATA ·atanhtab2076<> + 72(SB)/8, $0.213172484510484979E-02
40DATA ·atanhtab2076<> + 80(SB)/8, $0.623271047682013536E-02
41DATA ·atanhtab2076<> + 88(SB)/8, $0.118140812789696885E-01
42DATA ·atanhtab2076<> + 96(SB)/8, $0.187681358930914206E-01
43DATA ·atanhtab2076<> + 104(SB)/8, $0.269985148668178992E-01
44DATA ·atanhtab2076<> + 112(SB)/8, $0.364186619761331328E-01
45DATA ·atanhtab2076<> + 120(SB)/8, $0.469505379381388441E-01
46GLOBL ·atanhtab2076<> + 0(SB), RODATA, $128
47
48// Table of +/- .5
49DATA ·atanhtabh2075<> + 0(SB)/8, $0.5
50DATA ·atanhtabh2075<> + 8(SB)/8, $-.5
51GLOBL ·atanhtabh2075<> + 0(SB), RODATA, $16
52
53// Atanh returns the inverse hyperbolic tangent of the argument.
54//
55// Special cases are:
56// Atanh(1) = +Inf
57// Atanh(±0) = ±0
58// Atanh(-1) = -Inf
59// Atanh(x) = NaN if x < -1 or x > 1
60// Atanh(NaN) = NaN
61// The algorithm used is minimax polynomial approximation
62// with coefficients determined with a Remez exchange algorithm.
63
64TEXT ·atanhAsm(SB), NOSPLIT, $0-16
65 FMOVD x+0(FP), F0
66 MOVD $·atanhrodataL10<>+0(SB), R5
67 LGDR F0, R1
68 WORD $0xC0393FEF //iilf %r3,1072693247
69 BYTE $0xFF
70 BYTE $0xFF
71 SRAD $32, R1
72 WORD $0xB9170021 //llgtr %r2,%r1
73 MOVW R2, R6
74 MOVW R3, R7
75 CMPBGT R6, R7, L2
76 WORD $0xC0392FFF //iilf %r3,805306367
77 BYTE $0xFF
78 BYTE $0xFF
79 MOVW R2, R6
80 MOVW R3, R7
81 CMPBGT R6, R7, L9
82L3:
83 FMOVD 144(R5), F2
84 FMADD F2, F0, F0
85L1:
86 FMOVD F0, ret+8(FP)
87 RET
88
89L2:
90 WORD $0xED005088 //cdb %f0,.L12-.L10(%r5)
91 BYTE $0x00
92 BYTE $0x19
93 BEQ L5
94 WORD $0xED005080 //cdb %f0,.L13-.L10(%r5)
95 BYTE $0x00
96 BYTE $0x19
97 BEQ L5
98 WFCEDBS V0, V0, V2
99 BVS L1
100 FMOVD 120(R5), F0
101 BR L1
102L5:
103 WORD $0xED005070 //ddb %f0,.L15-.L10(%r5)
104 BYTE $0x00
105 BYTE $0x1D
106 FMOVD F0, ret+8(FP)
107 RET
108
109L9:
110 FMOVD F0, F2
111 MOVD $·atanhtabh2075<>+0(SB), R2
112 SRW $31, R1, R1
113 FMOVD 104(R5), F4
114 MOVW R1, R1
115 SLD $3, R1, R1
116 WORD $0x68012000 //ld %f0,0(%r1,%r2)
117 WFMADB V2, V4, V0, V4
118 VLEG $0, 96(R5), V16
119 FDIV F4, F2
120 WORD $0xC0298006 //iilf %r2,2147909631
121 BYTE $0x7F
122 BYTE $0xFF
123 FMOVD 88(R5), F6
124 FMOVD 80(R5), F1
125 FMOVD 72(R5), F7
126 FMOVD 64(R5), F5
127 FMOVD F2, F4
128 WORD $0xED405088 //adb %f4,.L12-.L10(%r5)
129 BYTE $0x00
130 BYTE $0x1A
131 LGDR F4, R4
132 SRAD $32, R4
133 FMOVD F4, F3
134 WORD $0xED305088 //sdb %f3,.L12-.L10(%r5)
135 BYTE $0x00
136 BYTE $0x1B
137 SUBW R4, R2
138 WFSDB V3, V2, V3
139 RISBGZ $32, $47, $0, R2, R1
140 SLD $32, R1, R1
141 LDGR R1, F2
142 WFMADB V4, V2, V16, V4
143 SRAW $8, R2, R1
144 WFMADB V4, V5, V6, V5
145 WFMDB V4, V4, V6
146 WFMADB V4, V1, V7, V1
147 WFMADB V2, V3, V4, V2
148 WFMADB V1, V6, V5, V1
149 FMOVD 56(R5), F3
150 FMOVD 48(R5), F5
151 WFMADB V4, V5, V3, V4
152 FMOVD 40(R5), F3
153 FMADD F1, F6, F4
154 FMOVD 32(R5), F1
155 FMADD F3, F2, F1
156 ANDW $0xFFFFFF00, R1
157 WFMADB V6, V4, V1, V6
158 FMOVD 24(R5), F3
159 ORW $0x45000000, R1
160 WFMADB V2, V6, V3, V6
161 VLVGF $0, R1, V4
162 LDEBR F4, F4
163 RISBGZ $57, $60, $51, R2, R2
164 MOVD $·atanhtab2076<>+0(SB), R1
165 FMOVD 16(R5), F3
166 WORD $0x68521000 //ld %f5,0(%r2,%r1)
167 FMOVD 8(R5), F1
168 WFMADB V2, V6, V5, V2
169 WFMADB V4, V3, V1, V4
170 FMOVD 0(R5), F6
171 FMADD F6, F4, F2
172 FMUL F2, F0
173 FMOVD F0, ret+8(FP)
174 RET
View as plain text