github.com/matrixorigin/matrixone@v1.2.0/pkg/container/hashtable/hash_arm64.go (about) 1 // Copyright 2021 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package hashtable 16 17 import ( 18 "runtime" 19 "unsafe" 20 21 "golang.org/x/sys/cpu" 22 ) 23 24 func crc32Int64BatchHash(data unsafe.Pointer, hashes *uint64, length int) 25 26 func aesBytesBatchGenHashStates(data *[]byte, states *[3]uint64, length int) 27 func aesInt192BatchGenHashStates(data *[3]uint64, states *[3]uint64, length int) 28 func aesInt256BatchGenHashStates(data *[4]uint64, states *[3]uint64, length int) 29 func aesInt320BatchGenHashStates(data *[5]uint64, states *[3]uint64, length int) 30 31 func init() { 32 if cpu.ARM64.HasCRC32 || (runtime.GOARCH == "arm64" && runtime.GOOS == "darwin") { 33 Int64BatchHash = crc32Int64BatchHash 34 } 35 36 if cpu.ARM64.HasAES || (runtime.GOARCH == "arm64" && runtime.GOOS == "darwin") { 37 BytesBatchGenHashStates = aesBytesBatchGenHashStates 38 Int192BatchGenHashStates = aesInt192BatchGenHashStates 39 Int256BatchGenHashStates = aesInt256BatchGenHashStates 40 Int320BatchGenHashStates = aesInt320BatchGenHashStates 41 } 42 }