github.com/matrixorigin/matrixone@v1.2.0/pkg/container/hashtable/hash_amd64.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  	"unsafe"
    19  
    20  	"golang.org/x/sys/cpu"
    21  )
    22  
    23  func crc32Int64BatchHash(data unsafe.Pointer, hashes *uint64, length int)
    24  
    25  func aesBytesBatchGenHashStates(data *[]byte, states *[3]uint64, length int)
    26  func aesInt192BatchGenHashStates(data *[3]uint64, states *[3]uint64, length int)
    27  func aesInt256BatchGenHashStates(data *[4]uint64, states *[3]uint64, length int)
    28  func aesInt320BatchGenHashStates(data *[5]uint64, states *[3]uint64, length int)
    29  
    30  func init() {
    31  	if cpu.X86.HasAVX {
    32  		Int64BatchHash = crc32Int64BatchHash
    33  
    34  		if cpu.X86.HasAES {
    35  			BytesBatchGenHashStates = aesBytesBatchGenHashStates
    36  			Int192BatchGenHashStates = aesInt192BatchGenHashStates
    37  			Int256BatchGenHashStates = aesInt256BatchGenHashStates
    38  			Int320BatchGenHashStates = aesInt320BatchGenHashStates
    39  		}
    40  	}
    41  }