diff options
Diffstat (limited to 'src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s')
-rw-r--r-- | src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s b/src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s index 7c6a1a5e68..39c58b44a3 100644 --- a/src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s +++ b/src/vendor/golang_org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s @@ -4,7 +4,7 @@ // This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare. -// +build go1.7 +// +build go1.7,amd64,!gccgo,!appengine #include "textflag.h" // General register allocation @@ -280,9 +280,14 @@ TEXT ·chacha20Poly1305Open(SB), 0, $288-97 // Check for AVX2 support CMPB runtime·support_avx2(SB), $0 JE noavx2bmi2Open - CMPB runtime·support_bmi2(SB), $1 // for MULXQ - JE chacha20Poly1305Open_AVX2 + + // Check BMI2 bit for MULXQ. + // runtime·cpuid_ebx7 is always available here + // because it passed avx2 check + TESTL $(1<<8), runtime·cpuid_ebx7(SB) + JNE chacha20Poly1305Open_AVX2 noavx2bmi2Open: + // Special optimization, for very short buffers CMPQ inl, $128 JBE openSSE128 // About 16% faster @@ -1489,9 +1494,14 @@ TEXT ·chacha20Poly1305Seal(SB), 0, $288-96 // Check for AVX2 support CMPB runtime·support_avx2(SB), $0 JE noavx2bmi2Seal - CMPB runtime·support_bmi2(SB), $1 // for MULXQ - JE chacha20Poly1305Seal_AVX2 + + // Check BMI2 bit for MULXQ. + // runtime·cpuid_ebx7 is always available here + // because it passed avx2 check + TESTL $(1<<8), runtime·cpuid_ebx7(SB) + JNE chacha20Poly1305Seal_AVX2 noavx2bmi2Seal: + // Special optimization, for very short buffers CMPQ inl, $128 JBE sealSSE128 // About 15% faster @@ -1695,7 +1705,7 @@ sealSSETail64: MOVO D1, ctr0Store sealSSETail64LoopA: - // Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext + // Perform ChaCha rounds, while hashing the previously encrypted ciphertext polyAdd(0(oup)) polyMul LEAQ 16(oup), oup @@ -1729,7 +1739,7 @@ sealSSETail128: MOVO A0, A1; MOVO B0, B1; MOVO C0, C1; MOVO D0, D1; PADDL ·sseIncMask<>(SB), D1; MOVO D1, ctr1Store sealSSETail128LoopA: - // Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext + // Perform ChaCha rounds, while hashing the previously encrypted ciphertext polyAdd(0(oup)) polyMul LEAQ 16(oup), oup @@ -1775,7 +1785,7 @@ sealSSETail192: MOVO A1, A2; MOVO B1, B2; MOVO C1, C2; MOVO D1, D2; PADDL ·sseIncMask<>(SB), D2; MOVO D2, ctr2Store sealSSETail192LoopA: - // Perform ChaCha rounds, while hashing the prevsiosly encrpyted ciphertext + // Perform ChaCha rounds, while hashing the previously encrypted ciphertext polyAdd(0(oup)) polyMul LEAQ 16(oup), oup |