• Lion Yang's avatar
    crypto: detect BMI usability on AMD64 for sha1 and sha256 · a2b615d5
    Lion Yang authored
    The existing implementations on AMD64 only detects AVX2 usability,
    when they also contains BMI (bit-manipulation instructions).
    These instructions crash the running program as 'unknown instructions'
    on the architecture, e.g. i3-4000M, which supports AVX2 but not
    support BMI.
    
    This change added the detections for BMI1 and BMI2 to AMD64 runtime with
    two flags as the result, `support_bmi1` and `support_bmi2`,
    in runtime/runtime2.go. It also completed the condition to run AVX2 version
    in packages crypto/sha1 and crypto/sha256.
    
    Fixes #18512
    
    Change-Id: I917bf0de365237740999de3e049d2e8f2a4385ad
    Reviewed-on: https://go-review.googlesource.com/34850Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    a2b615d5
Name
Last commit
Last update
..
example_test.go Loading commit data...
fallback_test.go Loading commit data...
sha256.go Loading commit data...
sha256_test.go Loading commit data...
sha256block.go Loading commit data...
sha256block_386.s Loading commit data...
sha256block_amd64.s Loading commit data...
sha256block_decl.go Loading commit data...
sha256block_generic.go Loading commit data...
sha256block_ppc64le.s Loading commit data...
sha256block_s390x.go Loading commit data...
sha256block_s390x.s Loading commit data...