0

64 bit CRC function exists on Intel SSE4.2 intrinsics.

unsigned __int64 _mm_crc32_u64 (unsigned __int64 crc, unsigned __int64 v)

However I can't find 256 bit version of CRC calculation on AVX2 intrinsics. I'm using 256 bit variables (__m256i) on my program, so I want to calculate crc (or hash) over 256 bits. How can I do this operation with Intel AVX2 ?

Paul R
  • 208,748
  • 37
  • 389
  • 560

1 Answers1

1

_mm_crc32_u64 is not a SIMD intrinsic, even though it's notionally part of SSE4.2 - it is just a normal scalar instruction which operates on 64 bit values. So it makes no sense to talk about 128 bit or 256 bit SIMD versions - you just need to apply it in a loop to an array of unsigned 64 bit values.

See this answer for a fuller explanation of the various x86 CRC32 instructions and intrinsics.

Community
  • 1
  • 1
Paul R
  • 208,748
  • 37
  • 389
  • 560
  • In that case, should I sum the crc values that coming from each 4 loops ? Because I want to represent 256 bit as a one crc value. – Burak Aydogan Apr 11 '17 at 11:22
  • You should not be adding CRCs - you should just cumulatively CRC all the data you are generating, in the correct sequence. If this is still not clear then you might need to start a new question, explain what you're trying to do, and include the relevant part of your existing code. – Paul R Apr 11 '17 at 11:26
  • On the other hand, Is it logical to apply sub operations (shifting, XOR, MOD2 etc.) to 256 bit vector like _mm_crc32_u64 function ? – Burak Aydogan Apr 11 '17 at 11:27
  • No, CRC is a sequential operation, so unless you want to generate separate CRCs for separate streams of data in parallel then you would just generate one CRC with a scalar loop, as already described in the answer above. – Paul R Apr 11 '17 at 11:29
  • I understand _mm_crc32_u64 operation now but I want to calculate CRC using 256bit (at least 128 bit) in one sequence for improving performance. I will ask a new question. – Burak Aydogan Apr 12 '17 at 10:42