1
0
mirror of https://github.com/golang/go synced 2024-10-02 14:28:38 -06:00
go/src/pkg/math/floor_386.s
Charles L. Dorian a0690b69da math: add functions; update tests and special cases
Added special cases to comments for asin.go and fabs.go.
Added Trunc() to floor.go and floor_386.s.  Fixed formatting
error in hypot_386.s  Added new functions Acosh, Asinh,
Atanh, Copysign, Erf, Erfc, Expm1, and Log1p.  Added
386 FPU version of Fmod.  Added tests, benchmarks, and
precision to expected results in all_test.go.  Edited
makefile so it all compiles.

R=rsc
CC=golang-dev
https://golang.org/cl/195052
2010-02-01 22:21:40 -08:00

45 lines
1.4 KiB
ArmAsm

// 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 Ceil(x float64) float64
TEXT ·Ceil(SB),7,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
ANDW $0xf3ff, AX
ORW $0x0800, AX // Rounding Control set to +Inf
MOVW AX, -4(SP) // store new Control Word
FLDCW -4(SP) // load new Control Word
FRNDINT // F0=Ceil(x)
FLDCW -2(SP) // load old Control Word
FMOVDP F0, r+8(FP)
RET
// func Floor(x float64) float64
TEXT ·Floor(SB),7,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
ANDW $0xf3ff, AX
ORW $0x0400, AX // Rounding Control set to -Inf
MOVW AX, -4(SP) // store new Control Word
FLDCW -4(SP) // load new Control Word
FRNDINT // F0=Floor(x)
FLDCW -2(SP) // load old Control Word
FMOVDP F0, r+8(FP)
RET
// func Trunc(x float64) float64
TEXT ·Trunc(SB),7,$0
FMOVD x+0(FP), F0 // F0=x
FSTCW -2(SP) // save old Control Word
MOVW -2(SP), AX
ORW $0x0c00, AX // Rounding Control set to truncate
MOVW AX, -4(SP) // store new Control Word
FLDCW -4(SP) // load new Control Word
FRNDINT // F0=Trunc(x)
FLDCW -2(SP) // load old Control Word
FMOVDP F0, r+8(FP)
RET