Added 386 platform to round and tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2024-04-11 10:36:10 +02:00
parent 38b0377f45
commit 1b2b3c22cb
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
4 changed files with 61 additions and 1 deletions

View file

@ -18,6 +18,33 @@ environment:
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 -v .
---
kind: pipeline
type: docker
name: from-source-386
platform:
os: linux
arch: amd64
environment:
GOPROXY: direct
GOARCH: 386
GO386: sse2
GOOS: linux
GOTRACEBACK: 2
GOEXPERIMENT: "cgocheck2,newinliner"
CGO_ENABLED: "0"
workspace:
path: /drone/src
steps:
- name: test
image: golang:1.22-alpine3.19

20
fpu/round_386.go Normal file
View file

@ -0,0 +1,20 @@
//go:build 386
package fpu
// stmxcsr reads the MXCSR control and status register.
//
//go:noescape
func stmxcsr(addr *uint32)
// ldmxcsr writes to the MXCSR control and status register.
//
//go:noescape
func ldmxcsr(addr *uint32)
func setRoundingMode(mode uint8) {
var csr uint32
stmxcsr(&csr)
csr = (csr & (^uint32(0x6000))) | ((uint32(mode) & 3) << 13)
ldmxcsr(&csr)
}

13
fpu/round_386.s Normal file
View file

@ -0,0 +1,13 @@
#include "textflag.h"
// stmxcsr reads the MXCSR control and status register.
TEXT ·stmxcsr(SB),NOSPLIT|NOFRAME,$0-4
MOVL addr+0(FP), SI
STMXCSR (SI)
RET
// ldmxcsr writes to the MXCSR control and status register.
TEXT ·ldmxcsr(SB),NOSPLIT|NOFRAME,$0-4
MOVL addr+0(FP), SI
LDMXCSR (SI)
RET

View file

@ -1,4 +1,4 @@
//go:build !arm64 && !amd64
//go:build !arm64 && !amd64 && !386
package fpu