litecoin-project/litecoin — pull request #75 by wtogami (2013-10-12 11:18:43+00:00)
Title: SSE2 optimized PoW Validation (DO NOT MERGE)

Significant performance boost is possible with the SSE2 intrinsic implementation from upstream tarsnap. Block hash PoW validation is a major bottleneck, so this can considerably speed up the client for all users. Win32 and Linux32 use cpuid feature runtime detection to choose between scrypt-generic and scrypt-sse2 which is set once in a function pointer during init.cpp. MacOS X 32bit and all 64bit is built to always use SSE2.

Please be very careful in reviewing this changeset! Some additional work is needed before it will be ready for merge. Theoretically it is safe enough for inclusion in a 0.8 stable release, but we really need the unit tests and bitcoin-qt.pro fixed before we do so.

SSE2 64bit has already been in testing in OMG2 Linux 64bit since mid-September.

INSTRUCTIONS
* Add ```USE_SSE2=1``` to litecoind make and qmake parameters.
* You must edit Makefile after qmake to add the ```-msse2``` parameter if you want to manually build it. This ugly hack is included in gitian.yml and gitian-win32.yml.

TODO:
* Fix scrypt unit test to use the same auto-detection. src/test/test_bitcoin.cpp should contain the stuff in init.cpp.
* bitcoin-qt.pro should use another ```QMAKE_EXTRA_COMPILERS``` which apparently is the only way to have qmake build scrypt-sse2.cpp with the added -msse2 parameter, but only if USE_SSE=1.
* Verify that the result builds fine on arm.

Obsoletes: #71 and #68 .