1// Copyright 2021 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 ppc64 || ppc64le 6 7#include "textflag.h" 8 9// On PPC64, 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 PPC64. 13 14// Convert float32->uint64 15TEXT ·archFloat32ToReg(SB),NOSPLIT,$0-16 16 FMOVS val+0(FP), F1 17 FMOVD F1, ret+8(FP) 18 RET 19 20// Convert uint64->float32 21TEXT ·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