github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/math/expm1_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 approximation and other constants 8 DATA ·expm1rodataL22<> + 0(SB)/8, $-1.0 9 DATA ·expm1rodataL22<> + 8(SB)/8, $800.0E+00 10 DATA ·expm1rodataL22<> + 16(SB)/8, $1.0 11 DATA ·expm1rodataL22<> + 24(SB)/8, $-.231904681384629956E-16 12 DATA ·expm1rodataL22<> + 32(SB)/8, $0.50000000000000029671E+00 13 DATA ·expm1rodataL22<> + 40(SB)/8, $0.16666666666666676570E+00 14 DATA ·expm1rodataL22<> + 48(SB)/8, $0.83333333323590973444E-02 15 DATA ·expm1rodataL22<> + 56(SB)/8, $0.13889096526400683566E-02 16 DATA ·expm1rodataL22<> + 64(SB)/8, $0.41666666661701152924E-01 17 DATA ·expm1rodataL22<> + 72(SB)/8, $0.19841562053987360264E-03 18 DATA ·expm1rodataL22<> + 80(SB)/8, $-.693147180559945286E+00 19 DATA ·expm1rodataL22<> + 88(SB)/8, $0.144269504088896339E+01 20 DATA ·expm1rodataL22<> + 96(SB)/8, $704.0E+00 21 GLOBL ·expm1rodataL22<> + 0(SB), RODATA, $104 22 23 DATA ·expm1xmone<> + 0(SB)/8, $0xbff0000000000000 24 GLOBL ·expm1xmone<> + 0(SB), RODATA, $8 25 DATA ·expm1xinf<> + 0(SB)/8, $0x7ff0000000000000 26 GLOBL ·expm1xinf<> + 0(SB), RODATA, $8 27 DATA ·expm1x4ff<> + 0(SB)/8, $0x4ff0000000000000 28 GLOBL ·expm1x4ff<> + 0(SB), RODATA, $8 29 DATA ·expm1x2ff<> + 0(SB)/8, $0x2ff0000000000000 30 GLOBL ·expm1x2ff<> + 0(SB), RODATA, $8 31 DATA ·expm1xaddexp<> + 0(SB)/8, $0xc2f0000100003ff0 32 GLOBL ·expm1xaddexp<> + 0(SB), RODATA, $8 33 34 // Log multipliers table 35 DATA ·expm1tab<> + 0(SB)/8, $0.0 36 DATA ·expm1tab<> + 8(SB)/8, $-.171540871271399150E-01 37 DATA ·expm1tab<> + 16(SB)/8, $-.306597931864376363E-01 38 DATA ·expm1tab<> + 24(SB)/8, $-.410200970469965021E-01 39 DATA ·expm1tab<> + 32(SB)/8, $-.486343079978231466E-01 40 DATA ·expm1tab<> + 40(SB)/8, $-.538226193725835820E-01 41 DATA ·expm1tab<> + 48(SB)/8, $-.568439602538111520E-01 42 DATA ·expm1tab<> + 56(SB)/8, $-.579091847395528847E-01 43 DATA ·expm1tab<> + 64(SB)/8, $-.571909584179366341E-01 44 DATA ·expm1tab<> + 72(SB)/8, $-.548312665987204407E-01 45 DATA ·expm1tab<> + 80(SB)/8, $-.509471843643441085E-01 46 DATA ·expm1tab<> + 88(SB)/8, $-.456353588448863359E-01 47 DATA ·expm1tab<> + 96(SB)/8, $-.389755254243262365E-01 48 DATA ·expm1tab<> + 104(SB)/8, $-.310332908285244231E-01 49 DATA ·expm1tab<> + 112(SB)/8, $-.218623539150173528E-01 50 DATA ·expm1tab<> + 120(SB)/8, $-.115062908917949451E-01 51 GLOBL ·expm1tab<> + 0(SB), RODATA, $128 52 53 // Expm1 returns e**x - 1, the base-e exponential of x minus 1. 54 // It is more accurate than Exp(x) - 1 when x is near zero. 55 // 56 // Special cases are: 57 // Expm1(+Inf) = +Inf 58 // Expm1(-Inf) = -1 59 // Expm1(NaN) = NaN 60 // Very large values overflow to -1 or +Inf. 61 // The algorithm used is minimax polynomial approximation using a table of 62 // polynomial coefficients determined with a Remez exchange algorithm. 63 64 TEXT ·expm1Asm(SB), NOSPLIT, $0-16 65 FMOVD x+0(FP), F0 66 MOVD $·expm1rodataL22<>+0(SB), R5 67 LTDBR F0, F0 68 BLTU L20 69 FMOVD F0, F2 70 L2: 71 WORD $0xED205060 //cdb %f2,.L23-.L22(%r5) 72 BYTE $0x00 73 BYTE $0x19 74 BGE L16 75 BVS L16 76 WFCEDBS V2, V2, V2 77 BVS LEXITTAGexpm1 78 MOVD $·expm1xaddexp<>+0(SB), R1 79 FMOVD 88(R5), F1 80 FMOVD 0(R1), F2 81 WFMSDB V0, V1, V2, V1 82 FMOVD 80(R5), F6 83 WFADB V1, V2, V4 84 FMOVD 72(R5), F2 85 FMADD F6, F4, F0 86 FMOVD 64(R5), F3 87 FMOVD 56(R5), F6 88 FMOVD 48(R5), F5 89 FMADD F2, F0, F6 90 WFMADB V0, V5, V3, V5 91 WFMDB V0, V0, V2 92 LGDR F1, R1 93 WFMADB V6, V2, V5, V6 94 FMOVD 40(R5), F3 95 FMOVD 32(R5), F5 96 WFMADB V0, V3, V5, V3 97 FMOVD 24(R5), F5 98 WFMADB V2, V6, V3, V2 99 FMADD F5, F4, F0 100 FMOVD 16(R5), F6 101 WFMADB V0, V2, V6, V2 102 RISBGZ $57, $60, $3, R1, R3 103 WORD $0xB3130022 //lcdbr %f2,%f2 104 MOVD $·expm1tab<>+0(SB), R2 105 WORD $0x68432000 //ld %f4,0(%r3,%r2) 106 FMADD F4, F0, F0 107 SLD $48, R1, R2 108 WFMSDB V2, V0, V4, V0 109 LDGR R2, F4 110 WORD $0xB3130000 //lcdbr %f0,%f0 111 FSUB F4, F6 112 WFMSDB V0, V4, V6, V0 113 FMOVD F0, ret+8(FP) 114 RET 115 L16: 116 WFCEDBS V2, V2, V4 117 BVS LEXITTAGexpm1 118 WORD $0xED205008 //cdb %f2,.L34-.L22(%r5) 119 BYTE $0x00 120 BYTE $0x19 121 BLT L6 122 WFCEDBS V2, V0, V0 123 BVS L7 124 MOVD $·expm1xinf<>+0(SB), R1 125 FMOVD 0(R1), F0 126 FMOVD F0, ret+8(FP) 127 RET 128 L20: 129 WORD $0xB3130020 //lcdbr %f2,%f0 130 BR L2 131 L6: 132 MOVD $·expm1xaddexp<>+0(SB), R1 133 FMOVD 88(R5), F5 134 FMOVD 0(R1), F4 135 WFMSDB V0, V5, V4, V5 136 FMOVD 80(R5), F3 137 WFADB V5, V4, V1 138 VLEG $0, 48(R5), V16 139 WFMADB V1, V3, V0, V3 140 FMOVD 56(R5), F4 141 FMOVD 64(R5), F7 142 FMOVD 72(R5), F6 143 WFMADB V3, V16, V7, V16 144 WFMADB V3, V6, V4, V6 145 WFMDB V3, V3, V4 146 MOVD $·expm1tab<>+0(SB), R2 147 WFMADB V6, V4, V16, V6 148 VLEG $0, 32(R5), V16 149 FMOVD 40(R5), F7 150 WFMADB V3, V7, V16, V7 151 VLEG $0, 24(R5), V16 152 WFMADB V4, V6, V7, V4 153 WFMADB V1, V16, V3, V1 154 FMOVD 16(R5), F6 155 FMADD F4, F1, F6 156 LGDR F5, R1 157 WORD $0xB3130066 //lcdbr %f6,%f6 158 RISBGZ $57, $60, $3, R1, R3 159 WORD $0x68432000 //ld %f4,0(%r3,%r2) 160 FMADD F4, F1, F1 161 MOVD $0x4086000000000000, R2 162 FMSUB F1, F6, F4 163 WORD $0xB3130044 //lcdbr %f4,%f4 164 WFCHDBS V2, V0, V0 165 BEQ L21 166 ADDW $0xF000, R1 167 RISBGN $0, $15, $48, R1, R2 168 LDGR R2, F0 169 FMADD F0, F4, F0 170 MOVD $·expm1x4ff<>+0(SB), R3 171 FMOVD 0(R5), F4 172 FMOVD 0(R3), F2 173 WFMADB V2, V0, V4, V0 174 FMOVD F0, ret+8(FP) 175 RET 176 L7: 177 MOVD $·expm1xmone<>+0(SB), R1 178 FMOVD 0(R1), F0 179 FMOVD F0, ret+8(FP) 180 RET 181 L21: 182 ADDW $0x1000, R1 183 RISBGN $0, $15, $48, R1, R2 184 LDGR R2, F0 185 FMADD F0, F4, F0 186 MOVD $·expm1x2ff<>+0(SB), R3 187 FMOVD 0(R5), F4 188 FMOVD 0(R3), F2 189 WFMADB V2, V0, V4, V0 190 FMOVD F0, ret+8(FP) 191 RET 192 LEXITTAGexpm1: 193 FMOVD F0, ret+8(FP) 194 RET