github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/math/atanh_s390x.s (about) 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 8 DATA ·atanhrodataL10<> + 0(SB)/8, $.41375273347623353626 9 DATA ·atanhrodataL10<> + 8(SB)/8, $.51487302528619766235E+04 10 DATA ·atanhrodataL10<> + 16(SB)/8, $-1.67526912689208984375 11 DATA ·atanhrodataL10<> + 24(SB)/8, $0.181818181818181826E+00 12 DATA ·atanhrodataL10<> + 32(SB)/8, $-.165289256198351540E-01 13 DATA ·atanhrodataL10<> + 40(SB)/8, $0.200350613573012186E-02 14 DATA ·atanhrodataL10<> + 48(SB)/8, $0.397389654305194527E-04 15 DATA ·atanhrodataL10<> + 56(SB)/8, $-.273205381970859341E-03 16 DATA ·atanhrodataL10<> + 64(SB)/8, $0.938370938292558173E-06 17 DATA ·atanhrodataL10<> + 72(SB)/8, $-.148682720127920854E-06 18 DATA ·atanhrodataL10<> + 80(SB)/8, $ 0.212881813645679599E-07 19 DATA ·atanhrodataL10<> + 88(SB)/8, $-.602107458843052029E-05 20 DATA ·atanhrodataL10<> + 96(SB)/8, $-5.5 21 DATA ·atanhrodataL10<> + 104(SB)/8, $-0.5 22 DATA ·atanhrodataL10<> + 112(SB)/8, $0.0 23 DATA ·atanhrodataL10<> + 120(SB)/8, $0x7ff8000000000000 //Nan 24 DATA ·atanhrodataL10<> + 128(SB)/8, $-1.0 25 DATA ·atanhrodataL10<> + 136(SB)/8, $1.0 26 DATA ·atanhrodataL10<> + 144(SB)/8, $1.0E-20 27 GLOBL ·atanhrodataL10<> + 0(SB), RODATA, $152 28 29 // Table of log correction terms 30 DATA ·atanhtab2076<> + 0(SB)/8, $0.585235384085551248E-01 31 DATA ·atanhtab2076<> + 8(SB)/8, $0.412206153771168640E-01 32 DATA ·atanhtab2076<> + 16(SB)/8, $0.273839003221648339E-01 33 DATA ·atanhtab2076<> + 24(SB)/8, $0.166383778368856480E-01 34 DATA ·atanhtab2076<> + 32(SB)/8, $0.866678223433169637E-02 35 DATA ·atanhtab2076<> + 40(SB)/8, $0.319831684989627514E-02 36 DATA ·atanhtab2076<> + 48(SB)/8, $0.000000000000000000E+00 37 DATA ·atanhtab2076<> + 56(SB)/8, $-.113006378583725549E-02 38 DATA ·atanhtab2076<> + 64(SB)/8, $-.367979419636602491E-03 39 DATA ·atanhtab2076<> + 72(SB)/8, $0.213172484510484979E-02 40 DATA ·atanhtab2076<> + 80(SB)/8, $0.623271047682013536E-02 41 DATA ·atanhtab2076<> + 88(SB)/8, $0.118140812789696885E-01 42 DATA ·atanhtab2076<> + 96(SB)/8, $0.187681358930914206E-01 43 DATA ·atanhtab2076<> + 104(SB)/8, $0.269985148668178992E-01 44 DATA ·atanhtab2076<> + 112(SB)/8, $0.364186619761331328E-01 45 DATA ·atanhtab2076<> + 120(SB)/8, $0.469505379381388441E-01 46 GLOBL ·atanhtab2076<> + 0(SB), RODATA, $128 47 48 // Table of +/- .5 49 DATA ·atanhtabh2075<> + 0(SB)/8, $0.5 50 DATA ·atanhtabh2075<> + 8(SB)/8, $-.5 51 GLOBL ·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 64 TEXT ·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 82 L3: 83 FMOVD 144(R5), F2 84 FMADD F2, F0, F0 85 L1: 86 FMOVD F0, ret+8(FP) 87 RET 88 89 L2: 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 102 L5: 103 WORD $0xED005070 //ddb %f0,.L15-.L10(%r5) 104 BYTE $0x00 105 BYTE $0x1D 106 FMOVD F0, ret+8(FP) 107 RET 108 109 L9: 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