diff options
author | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
---|---|---|
committer | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
commit | f154da9e12608589e8d5f0508f908a0c3e88a1bb (patch) | |
tree | f8255d51e10c6f1e0ed69702200b966c9556a431 /src/math/modf_386.s | |
parent | 8d8329ed5dfb9622c82a9fbec6fd99a580f9c9f6 (diff) | |
download | golang-upstream/1.4.tar.gz |
Imported Upstream version 1.4upstream/1.4
Diffstat (limited to 'src/math/modf_386.s')
-rw-r--r-- | src/math/modf_386.s | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/math/modf_386.s b/src/math/modf_386.s new file mode 100644 index 000000000..3debd3b95 --- /dev/null +++ b/src/math/modf_386.s @@ -0,0 +1,21 @@ +// 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. + +#include "textflag.h" + +// func Modf(f float64) (int float64, frac float64) +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 + 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(f), F1=f + FLDCW -2(SP) // load old Control Word + FSUBD F0, F1 // F0=trunc(f), F1=f-trunc(f) + FMOVDP F0, int+8(FP) // F0=f-trunc(f) + FMOVDP F0, frac+16(FP) + RET |