Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build for Graviton4 processor #283

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions galois_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ func galMulNEON(low, high, in, out []byte)
//go:noescape
func galMulXorNEON(low, high, in, out []byte)

func getVectorLength() (vl, pl uint64)

func init() {
if defaultOptions.useSVE {
if vl, _ := getVectorLength(); vl != 256 {
defaultOptions.useSVE = false // Temp fix: disable SVE for non-256 vector widths (ie Graviton4)
}
}
}

func galMulSlice(c byte, in, out []byte, o *options) {
if c == 1 {
copy(out, in)
Expand Down
13 changes: 13 additions & 0 deletions galois_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright 2015, Klaus Post, see LICENSE for details.
// Copyright 2017, Minio, Inc.

#include "textflag.h"

#define LOAD(LO1, LO2, HI1, HI2) \
VLD1.P 32(R1), [LO1.B16, LO2.B16] \
\
Expand Down Expand Up @@ -100,3 +102,14 @@ loopXor:

completeXor:
RET

TEXT ·getVectorLength(SB), NOSPLIT, $0
WORD $0xd2800002 // mov x2, #0
WORD $0x04225022 // addvl x2, x2, #1
WORD $0xd37df042 // lsl x2, x2, #3
WORD $0xd2800003 // mov x3, #0
WORD $0x04635023 // addpl x3, x3, #1
WORD $0xd37df063 // lsl x3, x3, #3
MOVD R2, vl+0(FP)
MOVD R3, pl+8(FP)
RET
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require github.com/klauspost/cpuid/v2 v2.2.6
require golang.org/x/sys v0.5.0 // indirect

retract (
v1.12.2 // https://github.com/klauspost/reedsolomon/pull/283
v1.11.6 // https://github.com/klauspost/reedsolomon/issues/240
[v1.11.3, v1.11.5] // https://github.com/klauspost/reedsolomon/pull/238
v1.11.2 // https://github.com/klauspost/reedsolomon/pull/229
Expand Down
Loading