Hi Everyone, I don't like the result of this strategy. It makes things very messy for X86 and X64. And ARMv7a and ARMv8 need a different strategy because the tricks below don't work. (The tricks don't work on ARM because linker has different behavior or ARM).
I put together some sample code that mostly takes Android's approach of splitting the source files. Its in the context of CRC-32C, which both SSE4.2 and ARMv8 provide. You can find it at https://github.com/noloader/CRC-Test. In the split source approach, crc.cpp has the C++ implementation; while crc-simd.cpp provides the implementation for SSE4.2 and ARMv8. crc-simd.cpp provides only Calculate_SSE4() and Calculate_ARMv8(). Please take a moment to look over the sample code, and provide comments or objections. Jeff On Saturday, May 20, 2017 at 6:11:07 PM UTC-4, Jeffrey Walton wrote: > > > I want to start adding the code back incrementally. I'm going to start >> with SHA since its the immediate painpoint. But we need to do it for >> AEN-NI, PCLMUL, SSE4, and some SSSE3. And we need to do it with ARM, but >> ARM's a little trickier because of some assembler goodness. For the ARM >> assembler issue see >> https://sourceware.org/ml/binutils/2017-04/msg00171.html. >> > > Here's an example of what it looks like using CRC32: > https://github.com/weidai11/cryptopp/commit/9d2455a69949 . > > There are two differences from the original code that was removed. First, > the workaround is in the relevant source file when possible. This keeps > cpu.h from growing unbounded. Second, some inline ASM will need template > versions to handle immediates. For example, here's SSSE3's shuffle: > > # define MM_SHUFFLE_EPI32(a,b) MM_SHUFFLE_EPI32_TEMPLATE<(b)>((a)) > > template <unsigned int b> > GCC_INLINE __m128i GCC_INLINE_ATTRIB > MM_SHUFFLE_EPI32_TEMPLATE(__m128i a) > { > // pshufd uses imm8 > asm ("pshufd %2, %1, %0" : "+x"(a) : "x"(a), "N"(b)); > return a; > } > -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.