Text file
src/math/atan_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 ·atanrodataL8<> + 0(SB)/8, $0.199999999999554423E+00
9DATA ·atanrodataL8<> + 8(SB)/8, $0.111111110136634272E+00
10DATA ·atanrodataL8<> + 16(SB)/8, $-.142857142828026806E+00
11DATA ·atanrodataL8<> + 24(SB)/8, $-.333333333333330928E+00
12DATA ·atanrodataL8<> + 32(SB)/8, $0.769228118888682505E-01
13DATA ·atanrodataL8<> + 40(SB)/8, $0.588059263575587687E-01
14DATA ·atanrodataL8<> + 48(SB)/8, $-.666641501287528609E-01
15DATA ·atanrodataL8<> + 56(SB)/8, $-.909090711945939878E-01
16DATA ·atanrodataL8<> + 64(SB)/8, $0.472329433805024762E-01
17DATA ·atanrodataL8<> + 72(SB)/8, $0.366935664549587481E-01
18DATA ·atanrodataL8<> + 80(SB)/8, $-.422172007412067035E-01
19DATA ·atanrodataL8<> + 88(SB)/8, $-.299856214685512712E-01
20DATA ·atanrodataL8<> + 96(SB)/8, $0.220852012160300086E-01
21DATA ·atanrodataL8<> + 104(SB)/8, $0.726338160757602439E-02
22DATA ·atanrodataL8<> + 112(SB)/8, $0.843488472994227321E-03
23DATA ·atanrodataL8<> + 120(SB)/8, $0.134893651284712515E-04
24DATA ·atanrodataL8<> + 128(SB)/8, $-.525380587584426406E-01
25DATA ·atanrodataL8<> + 136(SB)/8, $-.139950258898989925E-01
26DATA ·atanrodataL8<> + 144(SB)/8, $-.291935324869629616E-02
27DATA ·atanrodataL8<> + 152(SB)/8, $-.154797890856877418E-03
28GLOBL ·atanrodataL8<> + 0(SB), RODATA, $160
29
30DATA ·atanxpi2h<> + 0(SB)/8, $0x3ff330e4e4fa7b1b
31DATA ·atanxpi2h<> + 8(SB)/8, $0xbff330e4e4fa7b1b
32DATA ·atanxpi2h<> + 16(SB)/8, $0x400330e4e4fa7b1b
33DATA ·atanxpi2h<> + 24(SB)/4, $0xc00330e4e4fa7b1b
34GLOBL ·atanxpi2h<> + 0(SB), RODATA, $32
35DATA ·atanxpim<> + 0(SB)/8, $0x3ff4f42b00000000
36GLOBL ·atanxpim<> + 0(SB), RODATA, $8
37DATA ·atanxmone<> + 0(SB)/8, $-1.0
38GLOBL ·atanxmone<> + 0(SB), RODATA, $8
39
40// Atan returns the arctangent, in radians, of the argument.
41//
42// Special cases are:
43// Atan(±0) = ±0
44// Atan(±Inf) = ±Pi/2Pi
45// The algorithm used is minimax polynomial approximation
46// with coefficients determined with a Remez exchange algorithm.
47
48TEXT ·atanAsm(SB), NOSPLIT, $0-16
49 FMOVD x+0(FP), F0
50 //special case Atan(±0) = ±0
51 FMOVD $(0.0), F1
52 FCMPU F0, F1
53 BEQ atanIsZero
54
55 MOVD $·atanrodataL8<>+0(SB), R5
56 MOVH $0x3FE0, R3
57 LGDR F0, R1
58 RISBGNZ $32, $63, $32, R1, R1
59 RLL $16, R1, R2
60 ANDW $0x7FF0, R2
61 MOVW R2, R6
62 MOVW R3, R7
63 CMPUBLE R6, R7, L6
64 MOVD $·atanxmone<>+0(SB), R3
65 FMOVD 0(R3), F2
66 WFDDB V0, V2, V0
67 RISBGZ $63, $63, $33, R1, R1
68 MOVD $·atanxpi2h<>+0(SB), R3
69 MOVWZ R1, R1
70 SLD $3, R1, R1
71 WORD $0x68813000 //ld %f8,0(%r1,%r3)
72L6:
73 WFMDB V0, V0, V2
74 FMOVD 152(R5), F6
75 FMOVD 144(R5), F1
76 FMOVD 136(R5), F7
77 VLEG $0, 128(R5), V16
78 FMOVD 120(R5), F4
79 FMOVD 112(R5), F5
80 WFMADB V2, V4, V6, V4
81 WFMADB V2, V5, V1, V5
82 WFMDB V2, V2, V6
83 FMOVD 104(R5), F3
84 FMOVD 96(R5), F1
85 WFMADB V2, V3, V7, V3
86 MOVH $0x3FE0, R1
87 FMOVD 88(R5), F7
88 WFMADB V2, V1, V7, V1
89 FMOVD 80(R5), F7
90 WFMADB V6, V3, V1, V3
91 WFMADB V6, V4, V5, V4
92 WFMDB V6, V6, V1
93 FMOVD 72(R5), F5
94 WFMADB V2, V5, V7, V5
95 FMOVD 64(R5), F7
96 WFMADB V2, V7, V16, V7
97 VLEG $0, 56(R5), V16
98 WFMADB V6, V5, V7, V5
99 WFMADB V1, V4, V3, V4
100 FMOVD 48(R5), F7
101 FMOVD 40(R5), F3
102 WFMADB V2, V3, V7, V3
103 FMOVD 32(R5), F7
104 WFMADB V2, V7, V16, V7
105 VLEG $0, 24(R5), V16
106 WFMADB V1, V4, V5, V4
107 FMOVD 16(R5), F5
108 WFMADB V6, V3, V7, V3
109 FMOVD 8(R5), F7
110 WFMADB V2, V7, V5, V7
111 FMOVD 0(R5), F5
112 WFMADB V2, V5, V16, V5
113 WFMADB V1, V4, V3, V4
114 WFMADB V6, V7, V5, V6
115 FMUL F0, F2
116 FMADD F4, F1, F6
117 FMADD F6, F2, F0
118 MOVW R2, R6
119 MOVW R1, R7
120 CMPUBLE R6, R7, L1
121 MOVD $·atanxpim<>+0(SB), R1
122 WORD $0xED801000 //madb %f0,%f8,0(%r1)
123 BYTE $0x00
124 BYTE $0x1E
125L1:
126atanIsZero:
127 FMOVD F0, ret+8(FP)
128 RET
View as plain text