github.com/emmansun/gmsm@v0.29.1/sm3/sm3block_amd64.go (about) 1 //go:build !purego 2 3 package sm3 4 5 import "golang.org/x/sys/cpu" 6 7 var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI2 8 var useAVX = cpu.X86.HasAVX 9 var useSSSE3 = cpu.X86.HasSSSE3 10 11 //go:noescape 12 func blockAMD64(dig *digest, p []byte) 13 14 //go:noescape 15 func blockSIMD(dig *digest, p []byte) 16 17 //go:noescape 18 func blockAVX2(dig *digest, p []byte) 19 20 func block(dig *digest, p []byte) { 21 if useAVX2 { 22 blockAVX2(dig, p) 23 } else if useSSSE3 || useAVX { 24 blockSIMD(dig, p) 25 } else { 26 blockAMD64(dig, p) 27 } 28 }