Text file
src/reflect/float32reg_s390x.s
1 // Copyright 2025 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 //go:build s390x
6
7 #include "textflag.h"
8
9 // On s390x, the float32 becomes a float64
10 // when loaded in a register, different from
11 // other platforms. These functions are
12 // needed to ensure correct conversions on s390x.
13
14 // Convert float32->uint64
15 TEXT ·archFloat32ToReg(SB),NOSPLIT,$0-16
16 FMOVS val+0(FP), F1
17 FMOVD F1, ret+8(FP)
18 RET
19
20 // Convert uint64->float32
21 TEXT ·archFloat32FromReg(SB),NOSPLIT,$0-12
22 FMOVD reg+0(FP), F1
23 // Normally a float64->float32 conversion
24 // would need rounding, but that is not needed
25 // here since the uint64 was originally converted
26 // from float32, and should be avoided to
27 // preserve SNaN values.
28 FMOVS F1, ret+8(FP)
29 RET
30
31
View as plain text