1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 // func archCeil(x float64) float64
8 TEXT ·archCeil(SB),NOSPLIT,$0
9 FMOVD x+0(FP), F0 // F0=x
10 FSTCW -2(SP) // save old Control Word
13 ORW $0x0800, AX // Rounding Control set to +Inf
14 MOVW AX, -4(SP) // store new Control Word
15 FLDCW -4(SP) // load new Control Word
17 FLDCW -2(SP) // load old Control Word
21 // func archFloor(x float64) float64
22 TEXT ·archFloor(SB),NOSPLIT,$0
23 FMOVD x+0(FP), F0 // F0=x
24 FSTCW -2(SP) // save old Control Word
27 ORW $0x0400, AX // Rounding Control set to -Inf
28 MOVW AX, -4(SP) // store new Control Word
29 FLDCW -4(SP) // load new Control Word
30 FRNDINT // F0=Floor(x)
31 FLDCW -2(SP) // load old Control Word
35 // func archTrunc(x float64) float64
36 TEXT ·archTrunc(SB),NOSPLIT,$0
37 FMOVD x+0(FP), F0 // F0=x
38 FSTCW -2(SP) // save old Control Word
40 ORW $0x0c00, AX // Rounding Control set to truncate
41 MOVW AX, -4(SP) // store new Control Word
42 FLDCW -4(SP) // load new Control Word
43 FRNDINT // F0=Trunc(x)
44 FLDCW -2(SP) // load old Control Word