github.com/goproxy0/go@v0.0.0-20171111080102-49cc0c489d2c/src/math/log1p_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 // Constants 8 DATA ·log1pxlim<> + 0(SB)/4, $0xfff00000 9 GLOBL ·log1pxlim<> + 0(SB), RODATA, $4 10 DATA ·log1pxzero<> + 0(SB)/8, $0.0 11 GLOBL ·log1pxzero<> + 0(SB), RODATA, $8 12 DATA ·log1pxminf<> + 0(SB)/8, $0xfff0000000000000 13 GLOBL ·log1pxminf<> + 0(SB), RODATA, $8 14 DATA ·log1pxnan<> + 0(SB)/8, $0x7ff8000000000000 15 GLOBL ·log1pxnan<> + 0(SB), RODATA, $8 16 DATA ·log1pyout<> + 0(SB)/8, $0x40fce621e71da000 17 GLOBL ·log1pyout<> + 0(SB), RODATA, $8 18 DATA ·log1pxout<> + 0(SB)/8, $0x40f1000000000000 19 GLOBL ·log1pxout<> + 0(SB), RODATA, $8 20 DATA ·log1pxl2<> + 0(SB)/8, $0xbfda7aecbeba4e46 21 GLOBL ·log1pxl2<> + 0(SB), RODATA, $8 22 DATA ·log1pxl1<> + 0(SB)/8, $0x3ffacde700000000 23 GLOBL ·log1pxl1<> + 0(SB), RODATA, $8 24 DATA ·log1pxa<> + 0(SB)/8, $5.5 25 GLOBL ·log1pxa<> + 0(SB), RODATA, $8 26 DATA ·log1pxmone<> + 0(SB)/8, $-1.0 27 GLOBL ·log1pxmone<> + 0(SB), RODATA, $8 28 29 // Minimax polynomial approximations 30 DATA ·log1pc8<> + 0(SB)/8, $0.212881813645679599E-07 31 GLOBL ·log1pc8<> + 0(SB), RODATA, $8 32 DATA ·log1pc7<> + 0(SB)/8, $-.148682720127920854E-06 33 GLOBL ·log1pc7<> + 0(SB), RODATA, $8 34 DATA ·log1pc6<> + 0(SB)/8, $0.938370938292558173E-06 35 GLOBL ·log1pc6<> + 0(SB), RODATA, $8 36 DATA ·log1pc5<> + 0(SB)/8, $-.602107458843052029E-05 37 GLOBL ·log1pc5<> + 0(SB), RODATA, $8 38 DATA ·log1pc4<> + 0(SB)/8, $0.397389654305194527E-04 39 GLOBL ·log1pc4<> + 0(SB), RODATA, $8 40 DATA ·log1pc3<> + 0(SB)/8, $-.273205381970859341E-03 41 GLOBL ·log1pc3<> + 0(SB), RODATA, $8 42 DATA ·log1pc2<> + 0(SB)/8, $0.200350613573012186E-02 43 GLOBL ·log1pc2<> + 0(SB), RODATA, $8 44 DATA ·log1pc1<> + 0(SB)/8, $-.165289256198351540E-01 45 GLOBL ·log1pc1<> + 0(SB), RODATA, $8 46 DATA ·log1pc0<> + 0(SB)/8, $0.181818181818181826E+00 47 GLOBL ·log1pc0<> + 0(SB), RODATA, $8 48 49 50 // Table of log10 correction terms 51 DATA ·log1ptab<> + 0(SB)/8, $0.585235384085551248E-01 52 DATA ·log1ptab<> + 8(SB)/8, $0.412206153771168640E-01 53 DATA ·log1ptab<> + 16(SB)/8, $0.273839003221648339E-01 54 DATA ·log1ptab<> + 24(SB)/8, $0.166383778368856480E-01 55 DATA ·log1ptab<> + 32(SB)/8, $0.866678223433169637E-02 56 DATA ·log1ptab<> + 40(SB)/8, $0.319831684989627514E-02 57 DATA ·log1ptab<> + 48(SB)/8, $-.000000000000000000E+00 58 DATA ·log1ptab<> + 56(SB)/8, $-.113006378583725549E-02 59 DATA ·log1ptab<> + 64(SB)/8, $-.367979419636602491E-03 60 DATA ·log1ptab<> + 72(SB)/8, $0.213172484510484979E-02 61 DATA ·log1ptab<> + 80(SB)/8, $0.623271047682013536E-02 62 DATA ·log1ptab<> + 88(SB)/8, $0.118140812789696885E-01 63 DATA ·log1ptab<> + 96(SB)/8, $0.187681358930914206E-01 64 DATA ·log1ptab<> + 104(SB)/8, $0.269985148668178992E-01 65 DATA ·log1ptab<> + 112(SB)/8, $0.364186619761331328E-01 66 DATA ·log1ptab<> + 120(SB)/8, $0.469505379381388441E-01 67 GLOBL ·log1ptab<> + 0(SB), RODATA, $128 68 69 // Log1p returns the natural logarithm of 1 plus its argument x. 70 // It is more accurate than Log(1 + x) when x is near zero. 71 // 72 // Special cases are: 73 // Log1p(+Inf) = +Inf 74 // Log1p(±0) = ±0 75 // Log1p(-1) = -Inf 76 // Log1p(x < -1) = NaN 77 // Log1p(NaN) = NaN 78 // The algorithm used is minimax polynomial approximation 79 // with coefficients determined with a Remez exchange algorithm. 80 81 TEXT ·log1pAsm(SB), NOSPLIT, $0-16 82 FMOVD x+0(FP), F0 83 MOVD $·log1pxmone<>+0(SB), R1 84 MOVD ·log1pxout<>+0(SB), R2 85 FMOVD 0(R1), F3 86 MOVD $·log1pxa<>+0(SB), R1 87 MOVWZ ·log1pxlim<>+0(SB), R0 88 FMOVD 0(R1), F1 89 MOVD $·log1pc8<>+0(SB), R1 90 FMOVD 0(R1), F5 91 MOVD $·log1pc7<>+0(SB), R1 92 VLEG $0, 0(R1), V20 93 MOVD $·log1pc6<>+0(SB), R1 94 WFSDB V0, V3, V4 95 VLEG $0, 0(R1), V18 96 MOVD $·log1pc5<>+0(SB), R1 97 VLEG $0, 0(R1), V16 98 MOVD R2, R5 99 WORD $0xB3CD0034 //lgdr %r3,%f4 100 WORD $0xC0190006 //iilf %r1,425983 101 BYTE $0x7F 102 BYTE $0xFF 103 SRAD $32, R3, R3 104 SUBW R3, R1 105 SRW $16, R1, R1 106 BYTE $0x18 //lr %r4,%r1 107 BYTE $0x41 108 WORD $0xEC24000F //risbgn %r2,%r4,64-64+0,64-64+0+16-1,64-0-16 109 BYTE $0x30 110 BYTE $0x59 111 WORD $0xEC54101F //risbgn %r5,%r4,64-64+16,64-64+16+16-1,64-16-16 112 BYTE $0x20 113 BYTE $0x59 114 MOVW R0, R6 115 MOVW R3, R7 116 CMPBGT R6, R7, L8 117 WFCEDBS V4, V4, V6 118 MOVD $·log1pxzero<>+0(SB), R1 119 FMOVD 0(R1), F2 120 BVS LEXITTAGlog1p 121 WORD $0xB3130044 122 WFCEDBS V2, V4, V6 123 BEQ L9 124 WFCHDBS V4, V2, V2 125 BEQ LEXITTAGlog1p 126 MOVD $·log1pxnan<>+0(SB), R1 127 FMOVD 0(R1), F0 128 FMOVD F0, ret+8(FP) 129 RET 130 131 L8: 132 WORD $0xB3C10022 //ldgr %f2,%r2 133 FSUB F4, F3 134 FMADD F2, F4, F1 135 MOVD $·log1pc4<>+0(SB), R2 136 WORD $0xB3130041 137 FMOVD 0(R2), F7 138 FSUB F3, F0 139 MOVD $·log1pc3<>+0(SB), R2 140 FMOVD 0(R2), F3 141 MOVD $·log1pc2<>+0(SB), R2 142 WFMDB V1, V1, V6 143 FMADD F7, F4, F3 144 WFMSDB V0, V2, V1, V0 145 FMOVD 0(R2), F7 146 WFMADB V4, V5, V20, V5 147 MOVD $·log1pc1<>+0(SB), R2 148 FMOVD 0(R2), F2 149 FMADD F7, F4, F2 150 WFMADB V4, V18, V16, V4 151 FMADD F3, F6, F2 152 WFMADB V5, V6, V4, V5 153 FMUL F6, F6 154 MOVD $·log1pc0<>+0(SB), R2 155 WFMADB V6, V5, V2, V6 156 FMOVD 0(R2), F4 157 WFMADB V0, V6, V4, V6 158 WORD $0xEC1139BC //risbg %r1,%r1,57,128+60,3 159 BYTE $0x03 160 BYTE $0x55 161 MOVD $·log1ptab<>+0(SB), R2 162 MOVD $·log1pxl1<>+0(SB), R3 163 WORD $0x68112000 //ld %f1,0(%r1,%r2) 164 FMOVD 0(R3), F2 165 WFMADB V0, V6, V1, V0 166 MOVD $·log1pyout<>+0(SB), R1 167 WORD $0xB3C10065 //ldgr %f6,%r5 168 FMOVD 0(R1), F4 169 WFMSDB V2, V6, V4, V2 170 MOVD $·log1pxl2<>+0(SB), R1 171 FMOVD 0(R1), F4 172 FMADD F4, F2, F0 173 FMOVD F0, ret+8(FP) 174 RET 175 176 L9: 177 MOVD $·log1pxminf<>+0(SB), R1 178 FMOVD 0(R1), F0 179 FMOVD F0, ret+8(FP) 180 RET 181 182 183 LEXITTAGlog1p: 184 FMOVD F0, ret+8(FP) 185 RET 186