# Re: 4 hashes parallel on SSE2 CPUs for 0.3.6

Post by: satoshi on August 14, 2010, 10:06:13 PM<br>
Last edit: August 15, 2010, 03:43:47 AM by satoshi

MinGW GCC 4.5.0:<br>
Crypto++ doesn't work, X86\_SHA256\_HashBlocks() never returns<br>
I only got 4-way working with test.cpp but not when called by BitcoinMiner

MinGW GCC 4.4.1:<br>
Crypto++ works<br>
4-way SIGSEGV

GCC is definitely not aligning \_\_m128i.

Even if we align our own \_\_m128i variables, the compiler may decide to use a \_\_m128i behind the scenes as a temporary variable.

By making our \_\_m128i variables aligned and changing these inlines to defines, I was able to get it to work on 4.4.1 with -O0 only:<br>
\#define Ch(b, c, d) &nbsp;((b & c) ^ (~b & d))<br>
\#define Maj(b, c, d) &nbsp;((b & c) ^ (b & d) ^ (c & d))<br>
\#define ROTR(x, n) (\_mm\_srli\_epi32(x, n) | \_mm\_slli\_epi32(x, 32 - n))<br>
\#define SHR(x, n) &nbsp;\_mm\_srli\_epi32(x, n)

But that's with -O0.

---

Source file: bitcoin-forum-satoshi-nakamoto.tgz

External link: https://bitcointalk.org/index.php?topic=648.msg9278#msg9278
