1
0
mirror of https://github.com/fumiama/blake2b-simd.git synced 2026-06-11 13:40:27 +08:00

Add support for SSE (#10)

This commit is contained in:
Frank
2016-07-04 19:40:46 +02:00
committed by Harshavardhana
parent 4cf7fe6339
commit d2af7cb658
5 changed files with 1033 additions and 10 deletions

View File

@@ -24,8 +24,9 @@ func xgetbv(index uint32) (eax, edx uint32)
// True when SIMD instructions are available.
var avx2 = haveAVX2()
var avx = haveAVX()
var ssse3 = haveSSSE3()
// haveAVX returns true if when there is AVX support
// haveAVX returns true when there is AVX support
func haveAVX() bool {
_, _, c, _ := cpuid(1)
@@ -38,7 +39,7 @@ func haveAVX() bool {
return false
}
// haveAVX2 returns true if when there is AVX2 support
// haveAVX2 returns true when there is AVX2 support
func haveAVX2() bool {
mfi, _, _, _ := cpuid(0)
@@ -49,3 +50,11 @@ func haveAVX2() bool {
}
return false
}
// haveSSSE3 returns true when there is SSSE3 support
func haveSSSE3() bool {
_, _, c, _ := cpuid(1)
return (c & 0x00000200) != 0
}