Text file
src/reflect/float32reg_riscv64.s
1 // Copyright 2022 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.
4
5 #include "textflag.h"
6
7 // riscv64 allows 32-bit floats to live in the bottom
8 // part of the register, it expects them to be NaN-boxed.
9 // These functions are needed to ensure correct conversions
10 // on riscv64.
11
12 // Convert float32->uint64
13 TEXT ·archFloat32ToReg(SB),NOSPLIT,$0-16
14 MOVF val+0(FP), F1
15 MOVD F1, ret+8(FP)
16 RET
17
18 // Convert uint64->float32
19 TEXT ·archFloat32FromReg(SB),NOSPLIT,$0-12
20 // Normally a float64->float32 conversion
21 // would need rounding, but riscv64 store valid
22 // float32 in the lower 32 bits, thus we only need to
23 // unboxed the NaN-box by store a float32.
24 MOVD reg+0(FP), F1
25 MOVF F1, ret+8(FP)
26 RET
27
28
View as plain text