github.com/goproxy0/go@v0.0.0-20171111080102-49cc0c489d2c/src/math/atan_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 ·atanrodataL8<> + 0(SB)/8, $0.199999999999554423E+00 9 DATA ·atanrodataL8<> + 8(SB)/8, $0.111111110136634272E+00 10 DATA ·atanrodataL8<> + 16(SB)/8, $-.142857142828026806E+00 11 DATA ·atanrodataL8<> + 24(SB)/8, $-.333333333333330928E+00 12 DATA ·atanrodataL8<> + 32(SB)/8, $0.769228118888682505E-01 13 DATA ·atanrodataL8<> + 40(SB)/8, $0.588059263575587687E-01 14 DATA ·atanrodataL8<> + 48(SB)/8, $-.666641501287528609E-01 15 DATA ·atanrodataL8<> + 56(SB)/8, $-.909090711945939878E-01 16 DATA ·atanrodataL8<> + 64(SB)/8, $0.472329433805024762E-01 17 DATA ·atanrodataL8<> + 72(SB)/8, $0.366935664549587481E-01 18 DATA ·atanrodataL8<> + 80(SB)/8, $-.422172007412067035E-01 19 DATA ·atanrodataL8<> + 88(SB)/8, $-.299856214685512712E-01 20 DATA ·atanrodataL8<> + 96(SB)/8, $0.220852012160300086E-01 21 DATA ·atanrodataL8<> + 104(SB)/8, $0.726338160757602439E-02 22 DATA ·atanrodataL8<> + 112(SB)/8, $0.843488472994227321E-03 23 DATA ·atanrodataL8<> + 120(SB)/8, $0.134893651284712515E-04 24 DATA ·atanrodataL8<> + 128(SB)/8, $-.525380587584426406E-01 25 DATA ·atanrodataL8<> + 136(SB)/8, $-.139950258898989925E-01 26 DATA ·atanrodataL8<> + 144(SB)/8, $-.291935324869629616E-02 27 DATA ·atanrodataL8<> + 152(SB)/8, $-.154797890856877418E-03 28 GLOBL ·atanrodataL8<> + 0(SB), RODATA, $160 29 30 DATA ·atanxpi2h<> + 0(SB)/8, $0x3ff330e4e4fa7b1b 31 DATA ·atanxpi2h<> + 8(SB)/8, $0xbff330e4e4fa7b1b 32 DATA ·atanxpi2h<> + 16(SB)/8, $0x400330e4e4fa7b1b 33 DATA ·atanxpi2h<> + 24(SB)/4, $0xc00330e4e4fa7b1b 34 GLOBL ·atanxpi2h<> + 0(SB), RODATA, $32 35 DATA ·atanxpim<> + 0(SB)/8, $0x3ff4f42b00000000 36 GLOBL ·atanxpim<> + 0(SB), RODATA, $8 37 DATA ·atanxmone<> + 0(SB)/8, $-1.0 38 GLOBL ·atanxmone<> + 0(SB), RODATA, $8 39 40 // Atan returns the arctangent, in radians, of the argument. 41 // 42 // Special cases are: 43 // Atan(±0) = ±0 44 // Atan(±Inf) = ±Pi/2Pi 45 // The algorithm used is minimax polynomial approximation 46 // with coefficients determined with a Remez exchange algorithm. 47 48 TEXT ·atanAsm(SB), NOSPLIT, $0-16 49 FMOVD x+0(FP), F0 50 //special case Atan(±0) = ±0 51 FMOVD $(0.0), F1 52 FCMPU F0, F1 53 BEQ atanIsZero 54 55 MOVD $·atanrodataL8<>+0(SB), R5 56 MOVH $0x3FE0, R3 57 WORD $0xB3CD0010 //lgdr %r1,%f0 58 WORD $0xEC1120BF //risbgn %r1,%r1,64-32,128+63,64+0+32 59 BYTE $0x60 60 BYTE $0x59 61 RLL $16, R1, R2 62 ANDW $0x7FF0, R2 63 MOVW R2, R6 64 MOVW R3, R7 65 CMPUBLE R6, R7, L6 66 MOVD $·atanxmone<>+0(SB), R3 67 FMOVD 0(R3), F2 68 WFDDB V0, V2, V0 69 WORD $0xEC113FBF //risbg %r1,%r1,64-1,128+63,64+32+1 70 BYTE $0x61 71 BYTE $0x55 72 MOVD $·atanxpi2h<>+0(SB), R3 73 MOVWZ R1, R1 74 SLD $3, R1, R1 75 WORD $0x68813000 //ld %f8,0(%r1,%r3) 76 L6: 77 WFMDB V0, V0, V2 78 FMOVD 152(R5), F6 79 FMOVD 144(R5), F1 80 FMOVD 136(R5), F7 81 VLEG $0, 128(R5), V16 82 FMOVD 120(R5), F4 83 FMOVD 112(R5), F5 84 WFMADB V2, V4, V6, V4 85 WFMADB V2, V5, V1, V5 86 WFMDB V2, V2, V6 87 FMOVD 104(R5), F3 88 FMOVD 96(R5), F1 89 WFMADB V2, V3, V7, V3 90 MOVH $0x3FE0, R1 91 FMOVD 88(R5), F7 92 WFMADB V2, V1, V7, V1 93 FMOVD 80(R5), F7 94 WFMADB V6, V3, V1, V3 95 WFMADB V6, V4, V5, V4 96 WFMDB V6, V6, V1 97 FMOVD 72(R5), F5 98 WFMADB V2, V5, V7, V5 99 FMOVD 64(R5), F7 100 WFMADB V2, V7, V16, V7 101 VLEG $0, 56(R5), V16 102 WFMADB V6, V5, V7, V5 103 WFMADB V1, V4, V3, V4 104 FMOVD 48(R5), F7 105 FMOVD 40(R5), F3 106 WFMADB V2, V3, V7, V3 107 FMOVD 32(R5), F7 108 WFMADB V2, V7, V16, V7 109 VLEG $0, 24(R5), V16 110 WFMADB V1, V4, V5, V4 111 FMOVD 16(R5), F5 112 WFMADB V6, V3, V7, V3 113 FMOVD 8(R5), F7 114 WFMADB V2, V7, V5, V7 115 FMOVD 0(R5), F5 116 WFMADB V2, V5, V16, V5 117 WFMADB V1, V4, V3, V4 118 WFMADB V6, V7, V5, V6 119 FMUL F0, F2 120 FMADD F4, F1, F6 121 FMADD F6, F2, F0 122 MOVW R2, R6 123 MOVW R1, R7 124 CMPUBLE R6, R7, L1 125 MOVD $·atanxpim<>+0(SB), R1 126 WORD $0xED801000 //madb %f0,%f8,0(%r1) 127 BYTE $0x00 128 BYTE $0x1E 129 L1: 130 atanIsZero: 131 FMOVD F0, ret+8(FP) 132 RET