1
0
mirror of https://github.com/golang/go synced 2024-11-13 17:10:21 -07:00

math: convert textflags from numbers to symbols

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12773044
This commit is contained in:
Keith Randall 2013-08-12 10:25:18 -07:00
parent db324ccd72
commit 1f7966346e
67 changed files with 223 additions and 89 deletions

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Abs(x float64) float64 // func Abs(x float64) float64
TEXT ·Abs(SB),7,$0 TEXT ·Abs(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FABS // F0=|x| FABS // F0=|x|
FMOVDP F0, ret+8(FP) FMOVDP F0, ret+8(FP)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Abs(x float64) float64 // func Abs(x float64) float64
TEXT ·Abs(SB),7,$0 TEXT ·Abs(SB),NOSPLIT,$0
MOVQ $(1<<63), BX MOVQ $(1<<63), BX
MOVQ BX, X0 // movsd $(-0.0), x0 MOVQ BX, X0 // movsd $(-0.0), x0
MOVSD x+0(FP), X1 MOVSD x+0(FP), X1

View File

@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Abs(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Abs(SB),NOSPLIT,$0
MOVW x_lo+0(FP), R0 MOVW x_lo+0(FP), R0
MOVW x_hi+4(FP), R1 MOVW x_hi+4(FP), R1
AND $((1<<31)-1), R1 AND $((1<<31)-1), R1

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Asin(x float64) float64 // func Asin(x float64) float64
TEXT ·Asin(SB),7,$0 TEXT ·Asin(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=sin(x) FMOVD x+0(FP), F0 // F0=sin(x)
FMOVD F0, F1 // F0=sin(x), F1=sin(x) FMOVD F0, F1 // F0=sin(x), F1=sin(x)
FMULD F0, F0 // F0=sin(x)*sin(x), F1=sin(x) FMULD F0, F0 // F0=sin(x)*sin(x), F1=sin(x)
@ -15,7 +17,7 @@ TEXT ·Asin(SB),7,$0
RET RET
// func Acos(x float64) float64 // func Acos(x float64) float64
TEXT ·Acos(SB),7,$0 TEXT ·Acos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=cos(x) FMOVD x+0(FP), F0 // F0=cos(x)
FMOVD F0, F1 // F0=cos(x), F1=cos(x) FMOVD F0, F1 // F0=cos(x), F1=cos(x)
FMULD F0, F0 // F0=cos(x)*cos(x), F1=cos(x) FMULD F0, F0 // F0=cos(x)*cos(x), F1=cos(x)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Asin(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Asin(SB),NOSPLIT,$0
JMP ·asin(SB) JMP ·asin(SB)
TEXT ·Acos(SB),7,$0 TEXT ·Acos(SB),NOSPLIT,$0
JMP ·acos(SB) JMP ·acos(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Asin(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Asin(SB),NOSPLIT,$0
B ·asin(SB) B ·asin(SB)
TEXT ·Acos(SB),7,$0 TEXT ·Acos(SB),NOSPLIT,$0
B ·acos(SB) B ·acos(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Atan2(y, x float64) float64 // =atan(y/x) // func Atan2(y, x float64) float64 // =atan(y/x)
TEXT ·Atan2(SB),7,$0 TEXT ·Atan2(SB),NOSPLIT,$0
FMOVD y+0(FP), F0 // F0=y FMOVD y+0(FP), F0 // F0=y
FMOVD x+8(FP), F0 // F0=x, F1=y FMOVD x+8(FP), F0 // F0=x, F1=y
FPATAN // F0=atan(F1/F0) FPATAN // F0=atan(F1/F0)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Atan2(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Atan2(SB),NOSPLIT,$0
JMP ·atan2(SB) JMP ·atan2(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Atan2(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Atan2(SB),NOSPLIT,$0
B ·atan2(SB) B ·atan2(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Atan(x float64) float64 // func Atan(x float64) float64
TEXT ·Atan(SB),7,$0 TEXT ·Atan(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FLD1 // F0=1, F1=x FLD1 // F0=1, F1=x
FPATAN // F0=atan(F1/F0) FPATAN // F0=atan(F1/F0)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Atan(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Atan(SB),NOSPLIT,$0
JMP ·atan(SB) JMP ·atan(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Atan(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Atan(SB),NOSPLIT,$0
B ·atan(SB) B ·atan(SB)

View File

@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Dim(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Dim(SB),NOSPLIT,$0
JMP ·dim(SB) JMP ·dim(SB)
TEXT ·Max(SB),7,$0 TEXT ·Max(SB),NOSPLIT,$0
JMP ·max(SB) JMP ·max(SB)
TEXT ·Min(SB),7,$0 TEXT ·Min(SB),NOSPLIT,$0
JMP ·min(SB) JMP ·min(SB)

View File

@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define PosInf 0x7FF0000000000000 #define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001 #define NaN 0x7FF8000000000001
#define NegInf 0xFFF0000000000000 #define NegInf 0xFFF0000000000000
// func Dim(x, y float64) float64 // func Dim(x, y float64) float64
TEXT ·Dim(SB),7,$0 TEXT ·Dim(SB),NOSPLIT,$0
// (+Inf, +Inf) special case // (+Inf, +Inf) special case
MOVQ x+0(FP), BX MOVQ x+0(FP), BX
MOVQ y+8(FP), CX MOVQ y+8(FP), CX
@ -45,7 +47,7 @@ isDimNaN:
RET RET
// func ·Max(x, y float64) float64 // func ·Max(x, y float64) float64
TEXT ·Max(SB),7,$0 TEXT ·Max(SB),NOSPLIT,$0
// +Inf special cases // +Inf special cases
MOVQ $PosInf, AX MOVQ $PosInf, AX
MOVQ x+0(FP), R8 MOVQ x+0(FP), R8
@ -98,7 +100,7 @@ isMaxZero:
*/ */
// func Min(x, y float64) float64 // func Min(x, y float64) float64
TEXT ·Min(SB),7,$0 TEXT ·Min(SB),NOSPLIT,$0
// -Inf special cases // -Inf special cases
MOVQ $NegInf, AX MOVQ $NegInf, AX
MOVQ x+0(FP), R8 MOVQ x+0(FP), R8

View File

@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Dim(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Dim(SB),NOSPLIT,$0
B ·dim(SB) B ·dim(SB)
TEXT ·Min(SB),7,$0 TEXT ·Min(SB),NOSPLIT,$0
B ·min(SB) B ·min(SB)
TEXT ·Max(SB),7,$0 TEXT ·Max(SB),NOSPLIT,$0
B ·max(SB) B ·max(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Exp2(x float64) float64 // func Exp2(x float64) float64
TEXT ·Exp2(SB),7,$0 TEXT ·Exp2(SB),NOSPLIT,$0
// test bits for not-finite // test bits for not-finite
MOVL x_hi+4(FP), AX MOVL x_hi+4(FP), AX
ANDL $0x7ff00000, AX ANDL $0x7ff00000, AX

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Exp2(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Exp2(SB),NOSPLIT,$0
JMP ·exp2(SB) JMP ·exp2(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Exp2(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Exp2(SB),NOSPLIT,$0
B ·exp2(SB) B ·exp2(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Exp(x float64) float64 // func Exp(x float64) float64
TEXT ·Exp(SB),7,$0 TEXT ·Exp(SB),NOSPLIT,$0
// test bits for not-finite // test bits for not-finite
MOVL x_hi+4(FP), AX MOVL x_hi+4(FP), AX
ANDL $0x7ff00000, AX ANDL $0x7ff00000, AX

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// The method is based on a paper by Naoki Shibata: "Efficient evaluation // The method is based on a paper by Naoki Shibata: "Efficient evaluation
// methods of elementary functions suitable for SIMD computation", Proc. // methods of elementary functions suitable for SIMD computation", Proc.
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32 // of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
@ -31,7 +33,7 @@
#define NegInf 0xFFF0000000000000 #define NegInf 0xFFF0000000000000
// func Exp(x float64) float64 // func Exp(x float64) float64
TEXT ·Exp(SB),7,$0 TEXT ·Exp(SB),NOSPLIT,$0
// test bits for not-finite // test bits for not-finite
MOVQ x+0(FP), BX MOVQ x+0(FP), BX
MOVQ $~(1<<63), AX // sign bit mask MOVQ $~(1<<63), AX // sign bit mask

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Exp(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Exp(SB),NOSPLIT,$0
B ·exp(SB) B ·exp(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Expm1(x float64) float64 // func Expm1(x float64) float64
TEXT ·Expm1(SB),7,$0 TEXT ·Expm1(SB),NOSPLIT,$0
FLDLN2 // F0=log(2) = 1/log2(e) ~ 0.693147 FLDLN2 // F0=log(2) = 1/log2(e) ~ 0.693147
FMOVD x+0(FP), F0 // F0=x, F1=1/log2(e) FMOVD x+0(FP), F0 // F0=x, F1=1/log2(e)
FABS // F0=|x|, F1=1/log2(e) FABS // F0=|x|, F1=1/log2(e)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Expm1(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Expm1(SB),NOSPLIT,$0
JMP ·expm1(SB) JMP ·expm1(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Expm1(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Expm1(SB),NOSPLIT,$0
B ·expm1(SB) B ·expm1(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Ceil(x float64) float64 // func Ceil(x float64) float64
TEXT ·Ceil(SB),7,$0 TEXT ·Ceil(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX MOVW -2(SP), AX
@ -17,7 +19,7 @@ TEXT ·Ceil(SB),7,$0
RET RET
// func Floor(x float64) float64 // func Floor(x float64) float64
TEXT ·Floor(SB),7,$0 TEXT ·Floor(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX MOVW -2(SP), AX
@ -31,7 +33,7 @@ TEXT ·Floor(SB),7,$0
RET RET
// func Trunc(x float64) float64 // func Trunc(x float64) float64
TEXT ·Trunc(SB),7,$0 TEXT ·Trunc(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX MOVW -2(SP), AX

View File

@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define Big 0x4330000000000000 // 2**52 #define Big 0x4330000000000000 // 2**52
// func Floor(x float64) float64 // func Floor(x float64) float64
TEXT ·Floor(SB),7,$0 TEXT ·Floor(SB),NOSPLIT,$0
MOVQ x+0(FP), AX MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask MOVQ $~(1<<63), DX // sign bit mask
ANDQ AX,DX // DX = |x| ANDQ AX,DX // DX = |x|
@ -27,7 +29,7 @@ isBig_floor:
RET RET
// func Ceil(x float64) float64 // func Ceil(x float64) float64
TEXT ·Ceil(SB),7,$0 TEXT ·Ceil(SB),NOSPLIT,$0
MOVQ x+0(FP), AX MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask MOVQ $~(1<<63), DX // sign bit mask
MOVQ AX, BX // BX = copy of x MOVQ AX, BX // BX = copy of x
@ -53,7 +55,7 @@ isBig_ceil:
RET RET
// func Trunc(x float64) float64 // func Trunc(x float64) float64
TEXT ·Trunc(SB),7,$0 TEXT ·Trunc(SB),NOSPLIT,$0
MOVQ x+0(FP), AX MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask MOVQ $~(1<<63), DX // sign bit mask
MOVQ AX, BX // BX = copy of x MOVQ AX, BX // BX = copy of x

View File

@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Floor(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Floor(SB),NOSPLIT,$0
B ·floor(SB) B ·floor(SB)
TEXT ·Ceil(SB),7,$0 TEXT ·Ceil(SB),NOSPLIT,$0
B ·ceil(SB) B ·ceil(SB)
TEXT ·Trunc(SB),7,$0 TEXT ·Trunc(SB),NOSPLIT,$0
B ·trunc(SB) B ·trunc(SB)

View File

@ -23,7 +23,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
TEXT ·SetFPControl(SB), 7, $8 #include "../../cmd/ld/textflag.h"
TEXT ·SetFPControl(SB), NOSPLIT, $8
// Set new // Set new
MOVL p+0(FP), DI MOVL p+0(FP), DI
XORL $(0x3F<<7), DI XORL $(0x3F<<7), DI
@ -37,7 +39,7 @@ TEXT ·SetFPControl(SB), 7, $8
LDMXCSR 0(SP) LDMXCSR 0(SP)
RET RET
TEXT ·GetFPControl(SB), 7, $0 TEXT ·GetFPControl(SB), NOSPLIT, $0
WAIT WAIT
STMXCSR 0(SP) STMXCSR 0(SP)
MOVWLZX 0(SP), AX MOVWLZX 0(SP), AX

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Frexp(f float64) (frac float64, exp int) // func Frexp(f float64) (frac float64, exp int)
TEXT ·Frexp(SB),7,$0 TEXT ·Frexp(SB),NOSPLIT,$0
FMOVD f+0(FP), F0 // F0=f FMOVD f+0(FP), F0 // F0=f
FXAM FXAM
FSTSW AX FSTSW AX

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Frexp(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Frexp(SB),NOSPLIT,$0
JMP ·frexp(SB) JMP ·frexp(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Frexp(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Frexp(SB),NOSPLIT,$0
B ·frexp(SB) B ·frexp(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Hypot(p, q float64) float64 // func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0 TEXT ·Hypot(SB),NOSPLIT,$0
// test bits for not-finite // test bits for not-finite
MOVL p_hi+4(FP), AX // high word p MOVL p_hi+4(FP), AX // high word p
ANDL $0x7ff00000, AX ANDL $0x7ff00000, AX

View File

@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define PosInf 0x7FF0000000000000 #define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001 #define NaN 0x7FF8000000000001
// func Hypot(p, q float64) float64 // func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0 TEXT ·Hypot(SB),NOSPLIT,$0
// test bits for special cases // test bits for special cases
MOVQ p+0(FP), BX MOVQ p+0(FP), BX
MOVQ $~(1<<63), AX MOVQ $~(1<<63), AX

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Hypot(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Hypot(SB),NOSPLIT,$0
B ·hypot(SB) B ·hypot(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Ldexp(frac float64, exp int) float64 // func Ldexp(frac float64, exp int) float64
TEXT ·Ldexp(SB),7,$0 TEXT ·Ldexp(SB),NOSPLIT,$0
FMOVL exp+8(FP), F0 // F0=exp FMOVL exp+8(FP), F0 // F0=exp
FMOVD frac+0(FP), F0 // F0=frac, F1=e FMOVD frac+0(FP), F0 // F0=frac, F1=e
FSCALE // F0=x*2**e, F1=e FSCALE // F0=x*2**e, F1=e

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Ldexp(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Ldexp(SB),NOSPLIT,$0
JMP ·ldexp(SB) JMP ·ldexp(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Ldexp(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Ldexp(SB),NOSPLIT,$0
B ·ldexp(SB) B ·ldexp(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log10(x float64) float64 // func Log10(x float64) float64
TEXT ·Log10(SB),7,$0 TEXT ·Log10(SB),NOSPLIT,$0
FLDLG2 // F0=log10(2) FLDLG2 // F0=log10(2)
FMOVD x+0(FP), F0 // F0=x, F1=log10(2) FMOVD x+0(FP), F0 // F0=x, F1=log10(2)
FYL2X // F0=log10(x)=log2(x)*log10(2) FYL2X // F0=log10(x)=log2(x)*log10(2)
@ -11,7 +13,7 @@ TEXT ·Log10(SB),7,$0
RET RET
// func Log2(x float64) float64 // func Log2(x float64) float64
TEXT ·Log2(SB),7,$0 TEXT ·Log2(SB),NOSPLIT,$0
FLD1 // F0=1 FLD1 // F0=1
FMOVD x+0(FP), F0 // F0=x, F1=1 FMOVD x+0(FP), F0 // F0=x, F1=1
FYL2X // F0=log2(x) FYL2X // F0=log2(x)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Log10(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Log10(SB),NOSPLIT,$0
JMP ·log10(SB) JMP ·log10(SB)
TEXT ·Log2(SB),7,$0 TEXT ·Log2(SB),NOSPLIT,$0
JMP ·log2(SB) JMP ·log2(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Log10(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Log10(SB),NOSPLIT,$0
B ·log10(SB) B ·log10(SB)
TEXT ·Log2(SB),7,$0 TEXT ·Log2(SB),NOSPLIT,$0
B ·log2(SB) B ·log2(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log1p(x float64) float64 // func Log1p(x float64) float64
TEXT ·Log1p(SB),7,$0 TEXT ·Log1p(SB),NOSPLIT,$0
FMOVD $(2.928932188134524e-01), F0 FMOVD $(2.928932188134524e-01), F0
FMOVD x+0(FP), F0 // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564 FMOVD x+0(FP), F0 // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564
FABS // F0=|x|, F1=1-sqrt(2)/2 FABS // F0=|x|, F1=1-sqrt(2)/2

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Log1p(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Log1p(SB),NOSPLIT,$0
JMP ·log1p(SB) JMP ·log1p(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Log1p(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Log1p(SB),NOSPLIT,$0
B ·log1p(SB) B ·log1p(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log(x float64) float64 // func Log(x float64) float64
TEXT ·Log(SB),7,$0 TEXT ·Log(SB),NOSPLIT,$0
FLDLN2 // F0=log(2) FLDLN2 // F0=log(2)
FMOVD x+0(FP), F0 // F0=x, F1=log(2) FMOVD x+0(FP), F0 // F0=x, F1=log(2)
FYL2X // F0=log(x)=log2(x)*log(2) FYL2X // F0=log(x)=log2(x)*log(2)

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define HSqrt2 7.07106781186547524401e-01 // sqrt(2)/2 #define HSqrt2 7.07106781186547524401e-01 // sqrt(2)/2
#define Ln2Hi 6.93147180369123816490e-01 // 0x3fe62e42fee00000 #define Ln2Hi 6.93147180369123816490e-01 // 0x3fe62e42fee00000
#define Ln2Lo 1.90821492927058770002e-10 // 0x3dea39ef35793c76 #define Ln2Lo 1.90821492927058770002e-10 // 0x3dea39ef35793c76
@ -17,7 +19,7 @@
#define PosInf 0x7FF0000000000000 #define PosInf 0x7FF0000000000000
// func Log(x float64) float64 // func Log(x float64) float64
TEXT ·Log(SB),7,$0 TEXT ·Log(SB),NOSPLIT,$0
// test bits for special cases // test bits for special cases
MOVQ x+0(FP), BX MOVQ x+0(FP), BX
MOVQ $~(1<<63), AX // sign bit mask MOVQ $~(1<<63), AX // sign bit mask

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Log(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Log(SB),NOSPLIT,$0
B ·log(SB) B ·log(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Mod(x, y float64) float64 // func Mod(x, y float64) float64
TEXT ·Mod(SB),7,$0 TEXT ·Mod(SB),NOSPLIT,$0
FMOVD y+8(FP), F0 // F0=y FMOVD y+8(FP), F0 // F0=y
FMOVD x+0(FP), F0 // F0=x, F1=y FMOVD x+0(FP), F0 // F0=x, F1=y
FPREM // F0=reduced_x, F1=y FPREM // F0=reduced_x, F1=y

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Mod(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Mod(SB),NOSPLIT,$0
JMP ·mod(SB) JMP ·mod(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Mod(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Mod(SB),NOSPLIT,$0
B ·mod(SB) B ·mod(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Modf(f float64) (int float64, frac float64) // func Modf(f float64) (int float64, frac float64)
TEXT ·Modf(SB),7,$0 TEXT ·Modf(SB),NOSPLIT,$0
FMOVD f+0(FP), F0 // F0=f FMOVD f+0(FP), F0 // F0=f
FMOVD F0, F1 // F0=f, F1=f FMOVD F0, F1 // F0=f, F1=f
FSTCW -2(SP) // save old Control Word FSTCW -2(SP) // save old Control Word

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Modf(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Modf(SB),NOSPLIT,$0
JMP ·modf(SB) JMP ·modf(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Modf(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Modf(SB),NOSPLIT,$0
B ·modf(SB) B ·modf(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Remainder(x, y float64) float64 // func Remainder(x, y float64) float64
TEXT ·Remainder(SB),7,$0 TEXT ·Remainder(SB),NOSPLIT,$0
FMOVD y+8(FP), F0 // F0=y FMOVD y+8(FP), F0 // F0=y
FMOVD x+0(FP), F0 // F0=x, F1=y FMOVD x+0(FP), F0 // F0=x, F1=y
FPREM1 // F0=reduced_x, F1=y FPREM1 // F0=reduced_x, F1=y

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Remainder(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Remainder(SB),NOSPLIT,$0
JMP ·remainder(SB) JMP ·remainder(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Remainder(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Remainder(SB),NOSPLIT,$0
B ·remainder(SB) B ·remainder(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Cos(x float64) float64 // func Cos(x float64) float64
TEXT ·Cos(SB),7,$0 TEXT ·Cos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FCOS // F0=cos(x) if -2**63 < x < 2**63 FCOS // F0=cos(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word FSTSW AX // AX=status word
@ -24,7 +26,7 @@ TEXT ·Cos(SB),7,$0
RET RET
// func Sin(x float64) float64 // func Sin(x float64) float64
TEXT ·Sin(SB),7,$0 TEXT ·Sin(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FSIN // F0=sin(x) if -2**63 < x < 2**63 FSIN // F0=sin(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word FSTSW AX // AX=status word

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Sin(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Sin(SB),NOSPLIT,$0
JMP ·sin(SB) JMP ·sin(SB)
TEXT ·Cos(SB),7,$0 TEXT ·Cos(SB),NOSPLIT,$0
JMP ·cos(SB) JMP ·cos(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Sin(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Sin(SB),NOSPLIT,$0
B ·sin(SB) B ·sin(SB)
TEXT ·Cos(SB),7,$0 TEXT ·Cos(SB),NOSPLIT,$0
B ·cos(SB) B ·cos(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sincos(x float64) (sin, cos float64) // func Sincos(x float64) (sin, cos float64)
TEXT ·Sincos(SB),7,$0 TEXT ·Sincos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FSINCOS // F0=cos(x), F1=sin(x) if -2**63 < x < 2**63 FSINCOS // F0=cos(x), F1=sin(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word FSTSW AX // AX=status word

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// The method is based on a paper by Naoki Shibata: "Efficient evaluation // The method is based on a paper by Naoki Shibata: "Efficient evaluation
// methods of elementary functions suitable for SIMD computation", Proc. // methods of elementary functions suitable for SIMD computation", Proc.
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32 // of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
@ -31,7 +33,7 @@
#define T4 5.51146384479717813051146e-07 // (+1.0/1814400) #define T4 5.51146384479717813051146e-07 // (+1.0/1814400)
// func Sincos(d float64) (sin, cos float64) // func Sincos(d float64) (sin, cos float64)
TEXT ·Sincos(SB),7,$0 TEXT ·Sincos(SB),NOSPLIT,$0
// test for special cases // test for special cases
MOVQ $~(1<<63), DX // sign bit mask MOVQ $~(1<<63), DX // sign bit mask
MOVQ x+0(FP), BX MOVQ x+0(FP), BX

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Sincos(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Sincos(SB),NOSPLIT,$0
B ·sincos(SB) B ·sincos(SB)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64 // func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0 TEXT ·Sqrt(SB),NOSPLIT,$0
FMOVD x+0(FP),F0 FMOVD x+0(FP),F0
FSQRT FSQRT
FMOVDP F0,ret+8(FP) FMOVDP F0,ret+8(FP)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64 // func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0 TEXT ·Sqrt(SB),NOSPLIT,$0
SQRTSD x+0(FP), X0 SQRTSD x+0(FP), X0
MOVSD X0, ret+8(FP) MOVSD X0, ret+8(FP)
RET RET

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64 // func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0 TEXT ·Sqrt(SB),NOSPLIT,$0
MOVD x+0(FP),F0 MOVD x+0(FP),F0
SQRTD F0,F0 SQRTD F0,F0
MOVD F0,ret+8(FP) MOVD F0,ret+8(FP)

View File

@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Tan(x float64) float64 // func Tan(x float64) float64
TEXT ·Tan(SB),7,$0 TEXT ·Tan(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x FMOVD x+0(FP), F0 // F0=x
FPTAN // F0=1, F1=tan(x) if -2**63 < x < 2**63 FPTAN // F0=1, F1=tan(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word FSTSW AX // AX=status word

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Tan(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Tan(SB),NOSPLIT,$0
JMP ·tan(SB) JMP ·tan(SB)

View File

@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT ·Tan(SB),7,$0 #include "../../cmd/ld/textflag.h"
TEXT ·Tan(SB),NOSPLIT,$0
B ·tan(SB) B ·tan(SB)