Skip to content

Commit

Permalink
gate avx512 behind go1.22
Browse files Browse the repository at this point in the history
PCALIGN gives a ~12% performance improvement so we really want it, if you are using a previous version of go, too bad please upgrade.
  • Loading branch information
Jorropo committed Jun 20, 2024
1 parent 712cdad commit 1bea645
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions xxhash_asm_amd64.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build amd64 && !appengine && gc && !purego
// +build amd64,!appengine,gc,!purego
//go:build amd64 && !appengine && gc && !purego && go1.22
// +build amd64,!appengine,gc,!purego,go1.22

package xxhash

Expand Down
22 changes: 22 additions & 0 deletions xxhash_asm_amd64_old.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build amd64 && !appengine && gc && !purego && !go1.22
// +build amd64,!appengine,gc,!purego,!go1.22

// The avx512 impl relies on PCALIGN.

package xxhash

// Sum64 computes the 64-bit xxHash digest of b with a zero seed.
func Sum64(b []byte) uint64 {
return sum64Scalar(b)
}

//go:noescape
func sum64Scalar(b []byte) uint64

// extra is a first block before b, it may be nil then skip it.
func writeBlocks(d *Digest, extra *[32]byte, b []byte) {
return writeBlocksScalar(d, extra, b)
}

//go:noescape
func writeBlocksScalar(d *Digest, extra *[32]byte, b []byte)
3 changes: 2 additions & 1 deletion xxhash_avx512_amd64.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//go:build !appengine && gc && !purego
//go:build !appengine && gc && !purego && go1.22
// +build !appengine
// +build gc
// +build !purego
// +build go1.22

#include "textflag.h"

Expand Down

0 comments on commit 1bea645

Please sign in to comment.