Black Lives Matter. Support the Equal Justice Initiative.

# Text file src/math/dim_riscv64.s

## Documentation: math

```     1  // Copyright 2020 The Go Authors. All rights reserved.
2  // Use of this source code is governed by a BSD-style
4
5  #include "textflag.h"
6
7  // Values returned from an FCLASS instruction.
8  #define	NegInf	0x001
9  #define	PosInf	0x080
10  #define	NaN	0x200
11
12  // func archMax(x, y float64) float64
13  TEXT ·archMax(SB),NOSPLIT,\$0
14  	MOVD	x+0(FP), F0
15  	MOVD	y+8(FP), F1
16  	FCLASSD	F0, X5
17  	FCLASSD	F1, X6
18
19  	// +Inf special cases
20  	MOV	\$PosInf, X7
21  	BEQ	X7, X5, isMaxX
22  	BEQ	X7, X6, isMaxY
23
24  	// NaN special cases
25  	MOV	\$NaN, X7
26  	BEQ	X7, X5, isMaxX
27  	BEQ	X7, X6, isMaxY
28
29  	// normal case
30  	FMAXD	F0, F1, F0
31  	MOVD	F0, ret+16(FP)
32  	RET
33
34  isMaxX: // return x
35  	MOVD	F0, ret+16(FP)
36  	RET
37
38  isMaxY: // return y
39  	MOVD	F1, ret+16(FP)
40  	RET
41
42  // func archMin(x, y float64) float64
43  TEXT ·archMin(SB),NOSPLIT,\$0
44  	MOVD	x+0(FP), F0
45  	MOVD	y+8(FP), F1
46  	FCLASSD	F0, X5
47  	FCLASSD	F1, X6
48
49  	// -Inf special cases
50  	MOV	\$NegInf, X7
51  	BEQ	X7, X5, isMinX
52  	BEQ	X7, X6, isMinY
53
54  	// NaN special cases
55  	MOV	\$NaN, X7
56  	BEQ	X7, X5, isMinX
57  	BEQ	X7, X6, isMinY
58
59  	// normal case
60  	FMIND	F0, F1, F0
61  	MOVD	F0, ret+16(FP)
62  	RET
63
64  isMinX: // return x
65  	MOVD	F0, ret+16(FP)
66  	RET
67
68  isMinY: // return y
69  	MOVD	F1, ret+16(FP)
70  	RET
71
```

View as plain text