CRC32 calculation like in SSE4.2

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

CRC32 calculation like in SSE4.2

Post by Thorium »

SSE4.2 introduced a new very usefull instruction to calculate CRC32. But this instruction is not compatible to PB's CRC32Fingerprint. Which means we can not just use SSE4.2 and use CRC32Fingerprint as fallback if the CPU don't supports SSE4.2.

Currently this is not a big problem because SSE4.2 is pretty new and it is very likly that the CPU is not supporting it. But that will change with time passing and it will become extrem usefull to use it to speed up CRC32.

So what i am requesting is that you implement a second version of CRC32Fingerprint that outputs a CRC32 that is comparable with a CRC32 computed by SSE4.2.

Here is a little code showing how to use the SSE4.2 CRC32 in PureBasic: http://www.purebasic.fr/german/viewtopi ... =8&t=21165

And this is what the "Intel® 64 and IA-32 Architectures Software Developer’s Manual" says about the CRC32:
... accumulates a CRC32 (polynomial 0x11EDC6F41) value...

... Data contained in the source operand is processed in reflected bit order. This means that the most significant bit of the source operand is treated as the least significant bit of the quotient, and so on, for all the bits of the source operand. Likewise, the result of the CRC operation is stored in the destination operand in reflected bit order. This means that the most significant bit of the resulting CRC (bit 31) is stored in the least significant bit of the destination operand (bit 0), and so on, for all the bits of the CRC.
Hope that say anything to you how it's different from the PB implementation.