1
0
mirror of https://github.com/golang/go synced 2024-11-20 07:54:39 -07:00

math: amd64 versions of fdim, fmax, fmin

Uses the SSE2 max, min instructions. Also shorter sqrt_amd64.s

R=rsc
CC=golang-dev
https://golang.org/cl/1216042
This commit is contained in:
Charles L. Dorian 2010-05-18 22:33:50 -07:00 committed by Russ Cox
parent 879241d819
commit 809479740f
4 changed files with 37 additions and 2 deletions

View File

@ -7,6 +7,7 @@ include ../../Make.$(GOARCH)
TARG=math TARG=math
OFILES_amd64=\ OFILES_amd64=\
fdim_amd64.$O\
sqrt_amd64.$O\ sqrt_amd64.$O\
OFILES_386=\ OFILES_386=\

26
src/pkg/math/fdim_amd64.s Normal file
View File

@ -0,0 +1,26 @@
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// func Fdim(x, y float64) float64
TEXT ·Fdim(SB),7,$0
MOVSD x+0(FP), X0
SUBSD y+8(FP), X0
MOVSD $(0.0), X1
MAXSD X1, X0
MOVSD X0, r+16(FP)
RET
// func Fmax(x, y float64) float64
TEXT ·Fmax(SB),7,$0
MOVSD x+0(FP), X0
MAXSD y+8(FP), X0
MOVSD X0, r+16(FP)
RET
// func Fmin(x, y float64) float64
TEXT ·Fmin(SB),7,$0
MOVSD x+0(FP), X0
MINSD y+8(FP), X0
MOVSD X0, r+16(FP)
RET

View File

@ -0,0 +1,9 @@
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math
func Fdim(x, y float64) float64
func Fmax(x, y float64) float64
func Fmin(x, y float64) float64

View File

@ -4,7 +4,6 @@
// func Sqrt(x float64) float64 // func Sqrt(x float64) float64
TEXT ·Sqrt(SB),7,$0 TEXT ·Sqrt(SB),7,$0
MOVSD x+0(FP), X0 SQRTSD x+0(FP), X0
SQRTSD X0, X0
MOVSD X0, r+8(FP) MOVSD X0, r+8(FP)
RET RET