Add hard float support for arm platform, add tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
DataHoarder 2024-05-02 04:09:27 +02:00
parent a458a18f07
commit a7c4509d3d
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
7 changed files with 95 additions and 4 deletions

View file

@ -178,6 +178,61 @@ environment:
workspace:
path: /drone/src
steps:
- name: test
image: golang:1.22-alpine3.19
commands:
- apk update
- apk add --no-cache git
- go test -tags purego -p 1 -failfast -timeout 20m -cover -gcflags=-d=checkptr -short -v .
-
---
kind: pipeline
type: docker
name: go-arm-asm
platform:
os: linux
arch: arm64
environment:
GOPROXY: direct
GOARCH: arm
GOARM: 7
GOOS: linux
GOTRACEBACK: 2
GOEXPERIMENT: "cgocheck2,newinliner"
CGO_ENABLED: "0"
workspace:
path: /drone/src
steps:
- name: test
image: golang:1.22-alpine3.19
commands:
- apk update
- apk add --no-cache git
- go test -p 1 -failfast -timeout 20m -cover -gcflags=-d=checkptr -short -v .
---
kind: pipeline
type: docker
name: go-arm-purego
platform:
os: linux
arch: arm64
environment:
GOPROXY: direct
GOARCH: arm
GOARM: 7
GOOS: linux
GOTRACEBACK: 2
GOEXPERIMENT: "cgocheck2,newinliner"
CGO_ENABLED: "0"
workspace:
path: /drone/src
steps:
- name: test
image: golang:1.22-alpine3.19

View file

@ -22,7 +22,7 @@ For the C++ implementation and design of RandomX, see [github.com/tevador/Random
|:---------------------:|:----------:|:--------------:|:------:|:----------:|:------:|:------:|:-------:|:------:|
| purego | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Full Mode | ❌ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ❌ |
| Float Operations | hw | **hw** | soft | **hw** | soft | soft | soft | soft |
| Float Operations | hw | **hw** | **hw** | **hw** | soft | soft | soft | soft |
| AES Operations | soft | **hw** | soft | soft | soft | soft | soft | soft |
| Superscalar Execution | native | **native+jit** | native | native | native | native | native | native |
| VM Execution | **native** | **native+jit** | soft | **native** | soft | soft | soft | soft |

23
internal/asm/round_arm.go Normal file
View file

@ -0,0 +1,23 @@
//go:build (arm.6 || arm.7) && !purego
package asm
// GetFPSCR returns the value of FPSCR register.
func getFPSCR() (value uint32)
// SetFPSCR writes the FPSCR value.
func setFPSCR(value uint32)
func setRoundingMode(mode uint8) {
switch mode {
// switch plus/minus infinity
case 1:
mode = 2
case 2:
mode = 1
}
fpscr := getFPSCR()
fpscr = (fpscr & (^uint32(0x0C00000))) | ((uint32(mode) & 3) << 22)
setFPSCR(fpscr)
}

13
internal/asm/round_arm.s Normal file
View file

@ -0,0 +1,13 @@
//go:build (arm.6 || arm.7) && !purego
#include "textflag.h"
TEXT ·getFPSCR(SB),NOSPLIT,$0-4
WORD $0xeef1ba10 // vmrs r11, fpscr
MOVW R11, value+0(FP)
RET
TEXT ·setFPSCR(SB),NOSPLIT,$0-4
MOVW value+0(FP), R11
WORD $0xeee1ba10 // vmsr fpscr, r11
RET

View file

@ -1,4 +1,4 @@
//go:build (!arm64 && !amd64 && !386) || purego
//go:build (!arm64 && !(arm.6 || arm.7) && !amd64 && !386) || purego
package asm

View file

@ -1,4 +1,4 @@
//go:build (arm64 || amd64 || 386) && !purego
//go:build (arm64 || arm.6 || arm.7 || amd64 || 386) && !purego
package randomx

View file

@ -1,4 +1,4 @@
//go:build (!arm64 && !amd64 && !386) || purego
//go:build (!arm64 && !(arm.6 || arm.7) && !amd64 && !386) || purego
package randomx