Home | History | Annotate | Download | only in 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
      8 DATA acosrodataL13<> + 0(SB)/8, $0.314159265358979323E+01   //pi
      9 DATA acosrodataL13<> + 8(SB)/8, $-0.0
     10 DATA acosrodataL13<> + 16(SB)/8, $0x7ff8000000000000    //Nan
     11 DATA acosrodataL13<> + 24(SB)/8, $-1.0
     12 DATA acosrodataL13<> + 32(SB)/8, $1.0
     13 DATA acosrodataL13<> + 40(SB)/8, $0.166666666666651626E+00
     14 DATA acosrodataL13<> + 48(SB)/8, $0.750000000042621169E-01
     15 DATA acosrodataL13<> + 56(SB)/8, $0.446428567178116477E-01
     16 DATA acosrodataL13<> + 64(SB)/8, $0.303819660378071894E-01
     17 DATA acosrodataL13<> + 72(SB)/8, $0.223715011892010405E-01
     18 DATA acosrodataL13<> + 80(SB)/8, $0.173659424522364952E-01
     19 DATA acosrodataL13<> + 88(SB)/8, $0.137810186504372266E-01
     20 DATA acosrodataL13<> + 96(SB)/8, $0.134066870961173521E-01
     21 DATA acosrodataL13<> + 104(SB)/8, $-.412335502831898721E-02
     22 DATA acosrodataL13<> + 112(SB)/8, $0.867383739532082719E-01
     23 DATA acosrodataL13<> + 120(SB)/8, $-.328765950607171649E+00
     24 DATA acosrodataL13<> + 128(SB)/8, $0.110401073869414626E+01
     25 DATA acosrodataL13<> + 136(SB)/8, $-.270694366992537307E+01
     26 DATA acosrodataL13<> + 144(SB)/8, $0.500196500770928669E+01
     27 DATA acosrodataL13<> + 152(SB)/8, $-.665866959108585165E+01
     28 DATA acosrodataL13<> + 160(SB)/8, $-.344895269334086578E+01
     29 DATA acosrodataL13<> + 168(SB)/8, $0.927437952918301659E+00
     30 DATA acosrodataL13<> + 176(SB)/8, $0.610487478874645653E+01
     31 DATA acosrodataL13<> + 184(SB)/8, $0.157079632679489656e+01
     32 DATA acosrodataL13<> + 192(SB)/8, $0.0
     33 GLOBL acosrodataL13<> + 0(SB), RODATA, $200
     34 
     35 // Acos returns the arccosine, in radians, of the argument.
     36 //
     37 // Special case is:
     38 //      Acos(x) = NaN if x < -1 or x > 1
     39 // The algorithm used is minimax polynomial approximation
     40 // with coefficients determined with a Remez exchange algorithm.
     41 
     42 TEXT	acosAsm(SB), NOSPLIT, $0-16
     43 	FMOVD	x+0(FP), F0
     44 	MOVD	$acosrodataL13<>+0(SB), R9
     45 	WORD	$0xB3CD00C0	//lgdr %r12, %f0
     46 	FMOVD	F0, F10
     47 	SRAD	$32, R12
     48 	WORD	$0xC0293FE6	//iilf	%r2,1072079005
     49 	BYTE	$0xA0
     50 	BYTE	$0x9D
     51 	WORD	$0xB917001C	//llgtr	%r1,%r12
     52 	CMPW	R1,R2
     53 	BGT	L2
     54 	FMOVD	192(R9), F8
     55 	FMADD	F0, F0, F8
     56 	FMOVD	184(R9), F1
     57 L3:
     58 	WFMDB	V8, V8, V2
     59 	FMOVD	176(R9), F6
     60 	FMOVD	168(R9), F0
     61 	FMOVD	160(R9), F4
     62 	WFMADB	V2, V0, V6, V0
     63 	FMOVD	152(R9), F6
     64 	WFMADB	V2, V4, V6, V4
     65 	FMOVD	144(R9), F6
     66 	WFMADB	V2, V0, V6, V0
     67 	FMOVD	136(R9), F6
     68 	WFMADB	V2, V4, V6, V4
     69 	FMOVD	128(R9), F6
     70 	WFMADB	V2, V0, V6, V0
     71 	FMOVD	120(R9), F6
     72 	WFMADB	V2, V4, V6, V4
     73 	FMOVD	112(R9), F6
     74 	WFMADB	V2, V0, V6, V0
     75 	FMOVD	104(R9), F6
     76 	WFMADB	V2, V4, V6, V4
     77 	FMOVD	96(R9), F6
     78 	WFMADB	V2, V0, V6, V0
     79 	FMOVD	88(R9), F6
     80 	WFMADB	V2, V4, V6, V4
     81 	FMOVD	80(R9), F6
     82 	WFMADB	V2, V0, V6, V0
     83 	FMOVD	72(R9), F6
     84 	WFMADB	V2, V4, V6, V4
     85 	FMOVD	64(R9), F6
     86 	WFMADB	V2, V0, V6, V0
     87 	FMOVD	56(R9), F6
     88 	WFMADB	V2, V4, V6, V4
     89 	FMOVD	48(R9), F6
     90 	WFMADB	V2, V0, V6, V0
     91 	FMOVD	40(R9), F6
     92 	WFMADB	V2, V4, V6, V2
     93 	FMOVD	192(R9), F4
     94 	WFMADB	V8, V0, V2, V0
     95 	WFMADB	V10, V8, V4, V8
     96 	FMADD	F0, F8, F10
     97 	WFSDB	V10, V1, V10
     98 L1:
     99 	FMOVD	F10, ret+8(FP)
    100 	RET
    101 
    102 L2:
    103 	WORD	$0xC0293FEF	//iilf	%r2,1072693247
    104 	BYTE	$0xFF
    105 	BYTE	$0xFF
    106 	CMPW	R1, R2
    107 	BLE	L12
    108 L4:
    109 	WORD	$0xED009020	//cdb	%f0,.L34-.L13(%r9)
    110 	BYTE	$0x00
    111 	BYTE	$0x19
    112 	BEQ	L8
    113 	WORD	$0xED009018	//cdb	%f0,.L35-.L13(%r9)
    114 	BYTE	$0x00
    115 	BYTE	$0x19
    116 	BEQ	L9
    117 	WFCEDBS	V10, V10, V0
    118 	BVS	L1
    119 	FMOVD	16(R9), F10
    120 	BR	L1
    121 L12:
    122 	FMOVD	24(R9), F0
    123 	FMADD	F10, F10, F0
    124 	WORD	$0xB3130080	//lcdbr	%f8,%f0
    125 	WORD	$0xED009008	//cdb	%f0,.L37-.L13(%r9)
    126 	BYTE	$0x00
    127 	BYTE	$0x19
    128 	FSQRT	F8, F10
    129 L5:
    130 	MOVW	R12, R4
    131 	CMPBLE	R4, $0, L7
    132 	WORD	$0xB31300AA	//lcdbr	%f10,%f10
    133 	FMOVD	$0, F1
    134 	BR	L3
    135 L9:
    136 	FMOVD	0(R9), F10
    137 	BR	L1
    138 L8:
    139 	FMOVD	$0, F0
    140 	FMOVD	F0, ret+8(FP)
    141 	RET
    142 L7:
    143 	FMOVD	0(R9), F1
    144 	BR	L3
    145