Commit 1f796634 authored by Keith Randall's avatar Keith Randall

math: convert textflags from numbers to symbols

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12773044
parent db324ccd
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Abs(x float64) float64
TEXT ·Abs(SB),7,$0
TEXT ·Abs(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FABS // F0=|x|
FMOVDP F0, ret+8(FP)
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Abs(x float64) float64
TEXT ·Abs(SB),7,$0
TEXT ·Abs(SB),NOSPLIT,$0
MOVQ $(1<<63), BX
MOVQ BX, X0 // movsd $(-0.0), x0
MOVSD x+0(FP), X1
......
......@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// 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_hi+4(FP), R1
AND $((1<<31)-1), R1
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Asin(x float64) float64
TEXT ·Asin(SB),7,$0
TEXT ·Asin(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=sin(x)
FMOVD F0, F1 // F0=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
// func Acos(x float64) float64
TEXT ·Acos(SB),7,$0
TEXT ·Acos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=cos(x)
FMOVD F0, F1 // F0=cos(x), F1=cos(x)
FMULD F0, F0 // F0=cos(x)*cos(x), F1=cos(x)
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Acos(SB),7,$0
TEXT ·Acos(SB),NOSPLIT,$0
JMP ·acos(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Acos(SB),7,$0
TEXT ·Acos(SB),NOSPLIT,$0
B ·acos(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// 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 x+8(FP), F0 // F0=x, F1=y
FPATAN // F0=atan(F1/F0)
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Atan(x float64) float64
TEXT ·Atan(SB),7,$0
TEXT ·Atan(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FLD1 // F0=1, F1=x
FPATAN // F0=atan(F1/F0)
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Max(SB),7,$0
TEXT ·Max(SB),NOSPLIT,$0
JMP ·max(SB)
TEXT ·Min(SB),7,$0
TEXT ·Min(SB),NOSPLIT,$0
JMP ·min(SB)
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001
#define NegInf 0xFFF0000000000000
// func Dim(x, y float64) float64
TEXT ·Dim(SB),7,$0
TEXT ·Dim(SB),NOSPLIT,$0
// (+Inf, +Inf) special case
MOVQ x+0(FP), BX
MOVQ y+8(FP), CX
......@@ -45,7 +47,7 @@ isDimNaN:
RET
// func ·Max(x, y float64) float64
TEXT ·Max(SB),7,$0
TEXT ·Max(SB),NOSPLIT,$0
// +Inf special cases
MOVQ $PosInf, AX
MOVQ x+0(FP), R8
......@@ -98,7 +100,7 @@ isMaxZero:
*/
// func Min(x, y float64) float64
TEXT ·Min(SB),7,$0
TEXT ·Min(SB),NOSPLIT,$0
// -Inf special cases
MOVQ $NegInf, AX
MOVQ x+0(FP), R8
......
......@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Min(SB),7,$0
TEXT ·Min(SB),NOSPLIT,$0
B ·min(SB)
TEXT ·Max(SB),7,$0
TEXT ·Max(SB),NOSPLIT,$0
B ·max(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Exp2(x float64) float64
TEXT ·Exp2(SB),7,$0
TEXT ·Exp2(SB),NOSPLIT,$0
// test bits for not-finite
MOVL x_hi+4(FP), AX
ANDL $0x7ff00000, AX
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Exp(x float64) float64
TEXT ·Exp(SB),7,$0
TEXT ·Exp(SB),NOSPLIT,$0
// test bits for not-finite
MOVL x_hi+4(FP), AX
ANDL $0x7ff00000, AX
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// 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
// methods of elementary functions suitable for SIMD computation", Proc.
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
......@@ -31,7 +33,7 @@
#define NegInf 0xFFF0000000000000
// func Exp(x float64) float64
TEXT ·Exp(SB),7,$0
TEXT ·Exp(SB),NOSPLIT,$0
// test bits for not-finite
MOVQ x+0(FP), BX
MOVQ $~(1<<63), AX // sign bit mask
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Expm1(x float64) float64
TEXT ·Expm1(SB),7,$0
TEXT ·Expm1(SB),NOSPLIT,$0
FLDLN2 // F0=log(2) = 1/log2(e) ~ 0.693147
FMOVD x+0(FP), F0 // F0=x, F1=1/log2(e)
FABS // F0=|x|, F1=1/log2(e)
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Ceil(x float64) float64
TEXT ·Ceil(SB),7,$0
TEXT ·Ceil(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
......@@ -17,7 +19,7 @@ TEXT ·Ceil(SB),7,$0
RET
// func Floor(x float64) float64
TEXT ·Floor(SB),7,$0
TEXT ·Floor(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
......@@ -31,7 +33,7 @@ TEXT ·Floor(SB),7,$0
RET
// func Trunc(x float64) float64
TEXT ·Trunc(SB),7,$0
TEXT ·Trunc(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
......
......@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define Big 0x4330000000000000 // 2**52
// func Floor(x float64) float64
TEXT ·Floor(SB),7,$0
TEXT ·Floor(SB),NOSPLIT,$0
MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask
ANDQ AX,DX // DX = |x|
......@@ -27,7 +29,7 @@ isBig_floor:
RET
// func Ceil(x float64) float64
TEXT ·Ceil(SB),7,$0
TEXT ·Ceil(SB),NOSPLIT,$0
MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask
MOVQ AX, BX // BX = copy of x
......@@ -53,7 +55,7 @@ isBig_ceil:
RET
// func Trunc(x float64) float64
TEXT ·Trunc(SB),7,$0
TEXT ·Trunc(SB),NOSPLIT,$0
MOVQ x+0(FP), AX
MOVQ $~(1<<63), DX // sign bit mask
MOVQ AX, BX // BX = copy of x
......
......@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Ceil(SB),7,$0
TEXT ·Ceil(SB),NOSPLIT,$0
B ·ceil(SB)
TEXT ·Trunc(SB),7,$0
TEXT ·Trunc(SB),NOSPLIT,$0
B ·trunc(SB)
......@@ -23,7 +23,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
TEXT ·SetFPControl(SB), 7, $8
#include "../../cmd/ld/textflag.h"
TEXT ·SetFPControl(SB), NOSPLIT, $8
// Set new
MOVL p+0(FP), DI
XORL $(0x3F<<7), DI
......@@ -37,7 +39,7 @@ TEXT ·SetFPControl(SB), 7, $8
LDMXCSR 0(SP)
RET
TEXT ·GetFPControl(SB), 7, $0
TEXT ·GetFPControl(SB), NOSPLIT, $0
WAIT
STMXCSR 0(SP)
MOVWLZX 0(SP), AX
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// 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
FXAM
FSTSW AX
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0
TEXT ·Hypot(SB),NOSPLIT,$0
// test bits for not-finite
MOVL p_hi+4(FP), AX // high word p
ANDL $0x7ff00000, AX
......
......@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001
// func Hypot(p, q float64) float64
TEXT ·Hypot(SB),7,$0
TEXT ·Hypot(SB),NOSPLIT,$0
// test bits for special cases
MOVQ p+0(FP), BX
MOVQ $~(1<<63), AX
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Ldexp(frac float64, exp int) float64
TEXT ·Ldexp(SB),7,$0
TEXT ·Ldexp(SB),NOSPLIT,$0
FMOVL exp+8(FP), F0 // F0=exp
FMOVD frac+0(FP), F0 // F0=frac, F1=e
FSCALE // F0=x*2**e, F1=e
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log10(x float64) float64
TEXT ·Log10(SB),7,$0
TEXT ·Log10(SB),NOSPLIT,$0
FLDLG2 // F0=log10(2)
FMOVD x+0(FP), F0 // F0=x, F1=log10(2)
FYL2X // F0=log10(x)=log2(x)*log10(2)
......@@ -11,7 +13,7 @@ TEXT ·Log10(SB),7,$0
RET
// func Log2(x float64) float64
TEXT ·Log2(SB),7,$0
TEXT ·Log2(SB),NOSPLIT,$0
FLD1 // F0=1
FMOVD x+0(FP), F0 // F0=x, F1=1
FYL2X // F0=log2(x)
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Log2(SB),7,$0
TEXT ·Log2(SB),NOSPLIT,$0
JMP ·log2(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Log2(SB),7,$0
TEXT ·Log2(SB),NOSPLIT,$0
B ·log2(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log1p(x float64) float64
TEXT ·Log1p(SB),7,$0
TEXT ·Log1p(SB),NOSPLIT,$0
FMOVD $(2.928932188134524e-01), F0
FMOVD x+0(FP), F0 // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564
FABS // F0=|x|, F1=1-sqrt(2)/2
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Log(x float64) float64
TEXT ·Log(SB),7,$0
TEXT ·Log(SB),NOSPLIT,$0
FLDLN2 // F0=log(2)
FMOVD x+0(FP), F0 // F0=x, F1=log(2)
FYL2X // F0=log(x)=log2(x)*log(2)
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#define HSqrt2 7.07106781186547524401e-01 // sqrt(2)/2
#define Ln2Hi 6.93147180369123816490e-01 // 0x3fe62e42fee00000
#define Ln2Lo 1.90821492927058770002e-10 // 0x3dea39ef35793c76
......@@ -17,7 +19,7 @@
#define PosInf 0x7FF0000000000000
// func Log(x float64) float64
TEXT ·Log(SB),7,$0
TEXT ·Log(SB),NOSPLIT,$0
// test bits for special cases
MOVQ x+0(FP), BX
MOVQ $~(1<<63), AX // sign bit mask
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Mod(x, y float64) float64
TEXT ·Mod(SB),7,$0
TEXT ·Mod(SB),NOSPLIT,$0
FMOVD y+8(FP), F0 // F0=y
FMOVD x+0(FP), F0 // F0=x, F1=y
FPREM // F0=reduced_x, F1=y
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// 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 F0, F1 // F0=f, F1=f
FSTCW -2(SP) // save old Control Word
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Remainder(x, y float64) float64
TEXT ·Remainder(SB),7,$0
TEXT ·Remainder(SB),NOSPLIT,$0
FMOVD y+8(FP), F0 // F0=y
FMOVD x+0(FP), F0 // F0=x, F1=y
FPREM1 // F0=reduced_x, F1=y
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Cos(x float64) float64
TEXT ·Cos(SB),7,$0
TEXT ·Cos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FCOS // F0=cos(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word
......@@ -24,7 +26,7 @@ TEXT ·Cos(SB),7,$0
RET
// func Sin(x float64) float64
TEXT ·Sin(SB),7,$0
TEXT ·Sin(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FSIN // F0=sin(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Cos(SB),7,$0
TEXT ·Cos(SB),NOSPLIT,$0
JMP ·cos(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// 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)
TEXT ·Cos(SB),7,$0
TEXT ·Cos(SB),NOSPLIT,$0
B ·cos(SB)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sincos(x float64) (sin, cos float64)
TEXT ·Sincos(SB),7,$0
TEXT ·Sincos(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FSINCOS // F0=cos(x), F1=sin(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// 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
// methods of elementary functions suitable for SIMD computation", Proc.
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
......@@ -31,7 +33,7 @@
#define T4 5.51146384479717813051146e-07 // (+1.0/1814400)
// func Sincos(d float64) (sin, cos float64)
TEXT ·Sincos(SB),7,$0
TEXT ·Sincos(SB),NOSPLIT,$0
// test for special cases
MOVQ $~(1<<63), DX // sign bit mask
MOVQ x+0(FP), BX
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0
TEXT ·Sqrt(SB),NOSPLIT,$0
FMOVD x+0(FP),F0
FSQRT
FMOVDP F0,ret+8(FP)
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0
TEXT ·Sqrt(SB),NOSPLIT,$0
SQRTSD x+0(FP), X0
MOVSD X0, ret+8(FP)
RET
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0
TEXT ·Sqrt(SB),NOSPLIT,$0
MOVD x+0(FP),F0
SQRTD F0,F0
MOVD F0,ret+8(FP)
......
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
// func Tan(x float64) float64
TEXT ·Tan(SB),7,$0
TEXT ·Tan(SB),NOSPLIT,$0
FMOVD x+0(FP), F0 // F0=x
FPTAN // F0=1, F1=tan(x) if -2**63 < x < 2**63
FSTSW AX // AX=status word
......
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
......@@ -2,5 +2,7 @@
// Use of this source code is governed by a BSD-style
// 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment