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 asinrodataL15<> + 0(SB)/8, $-1.309611320495605469 9 DATA asinrodataL15<> + 8(SB)/8, $0x3ff921fb54442d18 10 DATA asinrodataL15<> + 16(SB)/8, $0xbff921fb54442d18 11 DATA asinrodataL15<> + 24(SB)/8, $1.309611320495605469 12 DATA asinrodataL15<> + 32(SB)/8, $-0.0 13 DATA asinrodataL15<> + 40(SB)/8, $1.199437040755305217 14 DATA asinrodataL15<> + 48(SB)/8, $0.166666666666651626E+00 15 DATA asinrodataL15<> + 56(SB)/8, $0.750000000042621169E-01 16 DATA asinrodataL15<> + 64(SB)/8, $0.446428567178116477E-01 17 DATA asinrodataL15<> + 72(SB)/8, $0.303819660378071894E-01 18 DATA asinrodataL15<> + 80(SB)/8, $0.223715011892010405E-01 19 DATA asinrodataL15<> + 88(SB)/8, $0.173659424522364952E-01 20 DATA asinrodataL15<> + 96(SB)/8, $0.137810186504372266E-01 21 DATA asinrodataL15<> + 104(SB)/8, $0.134066870961173521E-01 22 DATA asinrodataL15<> + 112(SB)/8, $-.412335502831898721E-02 23 DATA asinrodataL15<> + 120(SB)/8, $0.867383739532082719E-01 24 DATA asinrodataL15<> + 128(SB)/8, $-.328765950607171649E+00 25 DATA asinrodataL15<> + 136(SB)/8, $0.110401073869414626E+01 26 DATA asinrodataL15<> + 144(SB)/8, $-.270694366992537307E+01 27 DATA asinrodataL15<> + 152(SB)/8, $0.500196500770928669E+01 28 DATA asinrodataL15<> + 160(SB)/8, $-.665866959108585165E+01 29 DATA asinrodataL15<> + 168(SB)/8, $-.344895269334086578E+01 30 DATA asinrodataL15<> + 176(SB)/8, $0.927437952918301659E+00 31 DATA asinrodataL15<> + 184(SB)/8, $0.610487478874645653E+01 32 DATA asinrodataL15<> + 192(SB)/8, $0x7ff8000000000000 //+Inf 33 DATA asinrodataL15<> + 200(SB)/8, $-1.0 34 DATA asinrodataL15<> + 208(SB)/8, $1.0 35 DATA asinrodataL15<> + 216(SB)/8, $1.00000000000000000e-20 36 GLOBL asinrodataL15<> + 0(SB), RODATA, $224 37 38 // Asin returns the arcsine, in radians, of the argument. 39 // 40 // Special cases are: 41 // Asin(0) = 0= 42 // Asin(x) = NaN if x < -1 or x > 1 43 // The algorithm used is minimax polynomial approximation 44 // with coefficients determined with a Remez exchange algorithm. 45 46 TEXT asinAsm(SB), NOSPLIT, $0-16 47 FMOVD x+0(FP), F0 48 MOVD $asinrodataL15<>+0(SB), R9 49 WORD $0xB3CD0070 //lgdr %r7, %f0 50 FMOVD F0, F8 51 SRAD $32, R7 52 WORD $0xC0193FE6 //iilf %r1,1072079005 53 BYTE $0xA0 54 BYTE $0x9D 55 WORD $0xB91700C7 //llgtr %r12,%r7 56 MOVW R12, R8 57 MOVW R1, R6 58 CMPBGT R8, R6, L2 59 WORD $0xC0193BFF //iilf %r1,1006632959 60 BYTE $0xFF 61 BYTE $0xFF 62 MOVW R1, R6 63 CMPBGT R8, R6, L13 64 L3: 65 FMOVD 216(R9), F0 66 FMADD F0, F8, F8 67 L1: 68 FMOVD F8, ret+8(FP) 69 RET 70 L2: 71 WORD $0xC0193FEF //iilf %r1,1072693247 72 BYTE $0xFF 73 BYTE $0xFF 74 CMPW R12, R1 75 BLE L14 76 L5: 77 WORD $0xED0090D0 //cdb %f0,.L17-.L15(%r9) 78 BYTE $0x00 79 BYTE $0x19 80 BEQ L9 81 WORD $0xED0090C8 //cdb %f0,.L18-.L15(%r9) 82 BYTE $0x00 83 BYTE $0x19 84 BEQ L10 85 WFCEDBS V8, V8, V0 86 BVS L1 87 FMOVD 192(R9), F8 88 BR L1 89 L13: 90 WFMDB V0, V0, V10 91 L4: 92 WFMDB V10, V10, V0 93 FMOVD 184(R9), F6 94 FMOVD 176(R9), F2 95 FMOVD 168(R9), F4 96 WFMADB V0, V2, V6, V2 97 FMOVD 160(R9), F6 98 WFMADB V0, V4, V6, V4 99 FMOVD 152(R9), F6 100 WFMADB V0, V2, V6, V2 101 FMOVD 144(R9), F6 102 WFMADB V0, V4, V6, V4 103 FMOVD 136(R9), F6 104 WFMADB V0, V2, V6, V2 105 WORD $0xC0193FE6 //iilf %r1,1072079005 106 BYTE $0xA0 107 BYTE $0x9D 108 FMOVD 128(R9), F6 109 WFMADB V0, V4, V6, V4 110 FMOVD 120(R9), F6 111 WFMADB V0, V2, V6, V2 112 FMOVD 112(R9), F6 113 WFMADB V0, V4, V6, V4 114 FMOVD 104(R9), F6 115 WFMADB V0, V2, V6, V2 116 FMOVD 96(R9), F6 117 WFMADB V0, V4, V6, V4 118 FMOVD 88(R9), F6 119 WFMADB V0, V2, V6, V2 120 FMOVD 80(R9), F6 121 WFMADB V0, V4, V6, V4 122 FMOVD 72(R9), F6 123 WFMADB V0, V2, V6, V2 124 FMOVD 64(R9), F6 125 WFMADB V0, V4, V6, V4 126 FMOVD 56(R9), F6 127 WFMADB V0, V2, V6, V2 128 FMOVD 48(R9), F6 129 WFMADB V0, V4, V6, V0 130 WFMDB V8, V10, V4 131 FMADD F2, F10, F0 132 FMADD F0, F4, F8 133 CMPW R12, R1 134 BLE L1 135 FMOVD 40(R9), F0 136 FMADD F0, F1, F8 137 FMOVD F8, ret+8(FP) 138 RET 139 L14: 140 FMOVD 200(R9), F0 141 FMADD F8, F8, F0 142 WORD $0xB31300A0 //lcdbr %f10,%f0 143 WORD $0xED009020 //cdb %f0,.L39-.L15(%r9) 144 BYTE $0x00 145 BYTE $0x19 146 FSQRT F10, F8 147 L6: 148 MOVW R7, R6 149 CMPBLE R6, $0, L8 150 WORD $0xB3130088 //lcdbr %f8,%f8 151 FMOVD 24(R9), F1 152 BR L4 153 L10: 154 FMOVD 16(R9), F8 155 BR L1 156 L9: 157 FMOVD 8(R9), F8 158 FMOVD F8, ret+8(FP) 159 RET 160 L8: 161 FMOVD 0(R9), F1 162 BR L4 163