mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
Remove fnvHash16AVX2 to fix ARM compilation (#833)
* Remove fnvHash16AVX2 to fix ARM compilation * useAVX2 is now unnecessary
This commit is contained in:
parent
fa14c488cc
commit
f7b9846740
@ -32,7 +32,6 @@ import (
|
||||
"github.com/ledgerwatch/turbo-geth/crypto"
|
||||
"github.com/ledgerwatch/turbo-geth/log"
|
||||
"golang.org/x/crypto/sha3"
|
||||
"golang.org/x/sys/cpu"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -230,17 +229,6 @@ func fnvHash(mix []uint32, data []uint32) {
|
||||
}
|
||||
}
|
||||
|
||||
var useAVX2 = runtime.GOARCH == "amd64" && cpu.X86.HasAVX2
|
||||
|
||||
// fnvHash16 is a specialized version of fnvHash for 16 elements.
|
||||
func fnvHash16(mix []uint32, data []uint32) {
|
||||
if useAVX2 {
|
||||
fnvHash16AVX2(&mix[0], &data[0], 0x01000193)
|
||||
} else {
|
||||
fnvHash(mix, data)
|
||||
}
|
||||
}
|
||||
|
||||
// generateDatasetItem combines data from 256 pseudorandomly selected cache nodes,
|
||||
// and hashes that to compute a single dataset node.
|
||||
func generateDatasetItem(cache []uint32, index uint32, keccak512 hasher) []byte {
|
||||
@ -264,7 +252,7 @@ func generateDatasetItem(cache []uint32, index uint32, keccak512 hasher) []byte
|
||||
// fnv it with a lot of random cache nodes based on index
|
||||
for i := uint32(0); i < datasetParents; i++ {
|
||||
parent := fnv(index^i, intMix[i%16]) % rows
|
||||
fnvHash16(intMix, cache[parent*hashWords:])
|
||||
fnvHash(intMix, cache[parent*hashWords:])
|
||||
}
|
||||
// Flatten the uint32 mix into a binary one and return
|
||||
for i, val := range intMix {
|
||||
|
@ -1,10 +0,0 @@
|
||||
package ethash
|
||||
|
||||
//go:noescape
|
||||
func fnvHash16AVX2(data, mix *uint32, prime uint32)
|
||||
|
||||
/*
|
||||
for i := 0; i < 16; i++ {
|
||||
data[i] = data[i] * prime ^ mix[i]
|
||||
}
|
||||
*/
|
@ -1,21 +0,0 @@
|
||||
#include "textflag.h"
|
||||
|
||||
// func fnvHash16AVX2(data, mix *uint32, prime uint32)
|
||||
TEXT ·fnvHash16AVX2(SB), NOSPLIT, $0
|
||||
MOVQ data+0(FP), AX
|
||||
MOVQ mix+8(FP), BX
|
||||
MOVL prime+16(FP), X0
|
||||
|
||||
VPBROADCASTD X0, Y0
|
||||
|
||||
VPMULLD (AX), Y0, Y1
|
||||
VPXOR (BX), Y1, Y1
|
||||
VMOVDQU Y1, (AX)
|
||||
|
||||
VPMULLD 32(AX), Y0, Y0
|
||||
VPXOR 32(BX), Y0, Y0
|
||||
VMOVDQU Y0, 32(AX)
|
||||
|
||||
VZEROUPPER
|
||||
|
||||
RET
|
Loading…
Reference in New Issue
Block a user