summaryrefslogtreecommitdiff
path: root/src/pkg/math/modf_386.s
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-09-13 13:13:40 +0200
committerOndřej Surý <ondrej@sury.org>2011-09-13 13:13:40 +0200
commit5ff4c17907d5b19510a62e08fd8d3b11e62b431d (patch)
treec0650497e988f47be9c6f2324fa692a52dea82e1 /src/pkg/math/modf_386.s
parent80f18fc933cf3f3e829c5455a1023d69f7b86e52 (diff)
downloadgolang-upstream/60.tar.gz
Imported Upstream version 60upstream/60
Diffstat (limited to 'src/pkg/math/modf_386.s')
-rw-r--r--src/pkg/math/modf_386.s19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pkg/math/modf_386.s b/src/pkg/math/modf_386.s
new file mode 100644
index 000000000..5ccab9812
--- /dev/null
+++ b/src/pkg/math/modf_386.s
@@ -0,0 +1,19 @@
+// 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 Modf(x float64) (int float64, frac float64)
+TEXT ·Modf(SB),7,$0
+ FMOVD x+0(FP), F0 // F0=x
+ FMOVD F0, F1 // F0=x, F1=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), F1=x
+ FLDCW -2(SP) // load old Control Word
+ FSUBD F0, F1 // F0=trunc(x), F1=x-trunc(x)
+ FMOVDP F0, i+8(FP) // F0=x-trunc(x)
+ FMOVDP F0, f+16(FP)
+ RET