Text file
src/math/log_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 approximations
8DATA ·logrodataL21<> + 0(SB)/8, $-.499999999999999778E+00
9DATA ·logrodataL21<> + 8(SB)/8, $0.333333333333343751E+00
10DATA ·logrodataL21<> + 16(SB)/8, $-.250000000001606881E+00
11DATA ·logrodataL21<> + 24(SB)/8, $0.199999999971603032E+00
12DATA ·logrodataL21<> + 32(SB)/8, $-.166666663114122038E+00
13DATA ·logrodataL21<> + 40(SB)/8, $-.125002923782692399E+00
14DATA ·logrodataL21<> + 48(SB)/8, $0.111142014580396256E+00
15DATA ·logrodataL21<> + 56(SB)/8, $0.759438932618934220E-01
16DATA ·logrodataL21<> + 64(SB)/8, $0.142857144267212549E+00
17DATA ·logrodataL21<> + 72(SB)/8, $-.993038938793590759E-01
18DATA ·logrodataL21<> + 80(SB)/8, $-1.0
19GLOBL ·logrodataL21<> + 0(SB), RODATA, $88
20
21// Constants
22DATA ·logxminf<> + 0(SB)/8, $0xfff0000000000000
23GLOBL ·logxminf<> + 0(SB), RODATA, $8
24DATA ·logxnan<> + 0(SB)/8, $0x7ff8000000000000
25GLOBL ·logxnan<> + 0(SB), RODATA, $8
26DATA ·logx43f<> + 0(SB)/8, $0x43f0000000000000
27GLOBL ·logx43f<> + 0(SB), RODATA, $8
28DATA ·logxl2<> + 0(SB)/8, $0x3fda7aecbeba4e46
29GLOBL ·logxl2<> + 0(SB), RODATA, $8
30DATA ·logxl1<> + 0(SB)/8, $0x3ffacde700000000
31GLOBL ·logxl1<> + 0(SB), RODATA, $8
32
33/* Input transform scale and add constants */
34DATA ·logxm<> + 0(SB)/8, $0x3fc77604e63c84b1
35DATA ·logxm<> + 8(SB)/8, $0x40fb39456ab53250
36DATA ·logxm<> + 16(SB)/8, $0x3fc9ee358b945f3f
37DATA ·logxm<> + 24(SB)/8, $0x40fb39418bf3b137
38DATA ·logxm<> + 32(SB)/8, $0x3fccfb2e1304f4b6
39DATA ·logxm<> + 40(SB)/8, $0x40fb393d3eda3022
40DATA ·logxm<> + 48(SB)/8, $0x3fd0000000000000
41DATA ·logxm<> + 56(SB)/8, $0x40fb393969e70000
42DATA ·logxm<> + 64(SB)/8, $0x3fd11117aafbfe04
43DATA ·logxm<> + 72(SB)/8, $0x40fb3936eaefafcf
44DATA ·logxm<> + 80(SB)/8, $0x3fd2492af5e658b2
45DATA ·logxm<> + 88(SB)/8, $0x40fb39343ff01715
46DATA ·logxm<> + 96(SB)/8, $0x3fd3b50c622a43dd
47DATA ·logxm<> + 104(SB)/8, $0x40fb39315adae2f3
48DATA ·logxm<> + 112(SB)/8, $0x3fd56bbeea918777
49DATA ·logxm<> + 120(SB)/8, $0x40fb392e21698552
50GLOBL ·logxm<> + 0(SB), RODATA, $128
51
52// Log returns the natural logarithm of the argument.
53//
54// Special cases are:
55// Log(+Inf) = +Inf
56// Log(0) = -Inf
57// Log(x < 0) = NaN
58// Log(NaN) = NaN
59// The algorithm used is minimax polynomial approximation using a table of
60// polynomial coefficients determined with a Remez exchange algorithm.
61
62TEXT ·logAsm(SB), NOSPLIT, $0-16
63 FMOVD x+0(FP), F0
64 MOVD $·logrodataL21<>+0(SB), R9
65 MOVH $0x8006, R4
66 LGDR F0, R1
67 MOVD $0x3FF0000000000000, R6
68 SRAD $48, R1, R1
69 MOVD $0x40F03E8000000000, R8
70 SUBW R1, R4
71 RISBGZ $32, $59, $0, R4, R2
72 RISBGN $0, $15, $48, R2, R6
73 RISBGN $16, $31, $32, R2, R8
74 MOVW R1, R7
75 CMPBGT R7, $22, L17
76 LTDBR F0, F0
77 MOVD $·logx43f<>+0(SB), R1
78 FMOVD 0(R1), F2
79 BLEU L3
80 MOVH $0x8005, R12
81 MOVH $0x8405, R0
82 BR L15
83L7:
84 LTDBR F0, F0
85 BLEU L3
86L15:
87 FMUL F2, F0
88 LGDR F0, R1
89 SRAD $48, R1, R1
90 SUBW R1, R0, R2
91 SUBW R1, R12, R3
92 BYTE $0x18 //lr %r4,%r2
93 BYTE $0x42
94 ANDW $0xFFFFFFF0, R3
95 ANDW $0xFFFFFFF0, R2
96 BYTE $0x18 //lr %r5,%r1
97 BYTE $0x51
98 MOVW R1, R7
99 CMPBLE R7, $22, L7
100 RISBGN $0, $15, $48, R3, R6
101 RISBGN $16, $31, $32, R2, R8
102L2:
103 MOVH R5, R5
104 MOVH $0x7FEF, R1
105 CMPW R5, R1
106 BGT L1
107 LDGR R6, F2
108 FMUL F2, F0
109 RISBGZ $57, $59, $3, R4, R4
110 FMOVD 80(R9), F2
111 MOVD $·logxm<>+0(SB), R7
112 ADD R7, R4
113 FMOVD 72(R9), F4
114 WORD $0xED004000 //madb %f2,%f0,0(%r4)
115 BYTE $0x20
116 BYTE $0x1E
117 FMOVD 64(R9), F1
118 FMOVD F2, F0
119 FMOVD 56(R9), F2
120 WFMADB V0, V2, V4, V2
121 WFMDB V0, V0, V6
122 FMOVD 48(R9), F4
123 WFMADB V0, V2, V4, V2
124 FMOVD 40(R9), F4
125 WFMADB V2, V6, V1, V2
126 FMOVD 32(R9), F1
127 WFMADB V6, V4, V1, V4
128 FMOVD 24(R9), F1
129 WFMADB V6, V2, V1, V2
130 FMOVD 16(R9), F1
131 WFMADB V6, V4, V1, V4
132 MOVD $·logxl1<>+0(SB), R1
133 FMOVD 8(R9), F1
134 WFMADB V6, V2, V1, V2
135 FMOVD 0(R9), F1
136 WFMADB V6, V4, V1, V4
137 FMOVD 8(R4), F1
138 WFMADB V0, V2, V4, V2
139 LDGR R8, F4
140 WFMADB V6, V2, V0, V2
141 WORD $0xED401000 //msdb %f1,%f4,0(%r1)
142 BYTE $0x10
143 BYTE $0x1F
144 MOVD ·logxl2<>+0(SB), R1
145 WORD $0xB3130001 //lcdbr %f0,%f1
146 LDGR R1, F4
147 WFMADB V0, V4, V2, V0
148L1:
149 FMOVD F0, ret+8(FP)
150 RET
151L3:
152 LTDBR F0, F0
153 BEQ L20
154 BGE L1
155 BVS L1
156
157 MOVD $·logxnan<>+0(SB), R1
158 FMOVD 0(R1), F0
159 BR L1
160L20:
161 MOVD $·logxminf<>+0(SB), R1
162 FMOVD 0(R1), F0
163 FMOVD F0, ret+8(FP)
164 RET
165L17:
166 BYTE $0x18 //lr %r5,%r1
167 BYTE $0x51
168 BR L2
View as plain text