1 // Copyright 2016 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.
5 // Based on dim_amd64.s
9 #define PosInf 0x7FF0000000000000
10 #define NaN 0x7FF8000000000001
11 #define NegInf 0xFFF0000000000000
13 // func ·Max(x, y float64) float64
14 TEXT ·archMax(SB),NOSPLIT,$0
18 CMPUBEQ R4, R8, isPosInf
20 CMPUBEQ R4, R9, isPosInf
22 MOVD $~(1<<63), R5 // bit mask
26 CMPUBLT R4, R2, isMaxNaN
29 CMPUBLT R4, R3, isMaxNaN
42 isMaxNaN: // return NaN
44 isPosInf: // return +Inf
48 MOVD $(1<<63), R4 // -0.0
49 CMPUBEQ R4, R8, +3(PC)
50 MOVD R8, ret+16(FP) // return 0
52 MOVD R9, ret+16(FP) // return other 0
55 // func archMin(x, y float64) float64
56 TEXT ·archMin(SB),NOSPLIT,$0
60 CMPUBEQ R4, R8, isNegInf
62 CMPUBEQ R4, R9, isNegInf
68 CMPUBLT R4, R2, isMinNaN
71 CMPUBLT R4, R3, isMinNaN
84 isMinNaN: // return NaN
86 isNegInf: // return -Inf
90 MOVD $(1<<63), R4 // -0.0
91 CMPUBEQ R4, R8, +3(PC)
92 MOVD R9, ret+16(FP) // return other 0
94 MOVD R8, ret+16(FP) // return -0