Page MenuHomePhabricator

[CMAKE] Enable SSE4.1, SHA-NI and AVX2 for the crypto library
ClosedPublic

Authored by Fabien on Dec 12 2019, 09:46.

Details

Summary

They are enabled if the hardware support the appropriated instructions.

Test Plan

Edit src/bench/bench_bitcoin.cpp and replace the line:

SHA256AutoDetect();

With:

std::cout << SHA256AutoDetect() <<std::endl;

Then

cmake -GNinja ..
ninja bitcoin-bench
./src/bench/bitcoin-bench -filter=SHA256

Check that the enabled features match your hardware capabilities by
looking at the CPU flags in /proc/cpuinfo.
Checked with all flags and without avx2.

Run the gitian builds.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_crypto_intrinsics
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 8519
Build 15037: Default Diff Build & Tests
Build 15036: arc lint + arc unit

Event Timeline

Fabien planned changes to this revision.Dec 12 2019, 09:48

Waiting for gitian builds

Fabien requested review of this revision.Dec 12 2019, 10:43

Not to reviewers: this diff introduces some new -Wcast-align warnings.
The reason they don't show up with autotools is simply that the flag is not enabled.

This revision is now accepted and ready to land.Dec 12 2019, 18:34