go-randomx/fpu/round_arm64.go
DataHoarder b207b994b3
All checks were successful
continuous-integration/drone/push Build is passing
Working RandomX with minimal assembly for rounding mode (AMD64,ARM64)
2024-04-11 08:46:34 +02:00

25 lines
415 B
Go

//go:build arm64
// +build arm64
package fpu
// GetFPCR returns the value of FPCR register.
func getFPCR() (value uint32)
// SetFPCR writes the FPCR value.
func setFPCR(value uint32)
func setRoundingMode(mode uint8) {
switch mode {
// switch plus/minus infinity
case 1:
mode = 2
case 2:
mode = 1
}
fpcr := getFPCR()
fpcr = (fpcr & (^uint32(0x0C00000))) | ((uint32(mode) & 3) << 22)
setFPCR(fpcr)
}