cpu_avx512skx.cpp 834 B

1234567891011121314151617181920212223242526272829303132
  1. #if defined __AVX512__ || defined __AVX512F__
  2. #include <immintrin.h>
  3. // Workaround for problem with GCC 5-6 in -O0 mode
  4. struct v_uint32x16
  5. {
  6. __m512i val;
  7. explicit v_uint32x16(__m512i v) : val(v) {}
  8. };
  9. inline v_uint32x16 operator << (const v_uint32x16& a, int imm)
  10. {
  11. return v_uint32x16(_mm512_slli_epi32(a.val, imm));
  12. }
  13. void test()
  14. {
  15. __m512i zmm = _mm512_setzero_si512();
  16. __m256i a = _mm256_setzero_si256();
  17. __m256i b = _mm256_abs_epi64(a); // VL
  18. __m512i c = _mm512_abs_epi8(zmm); // BW
  19. __m512i d = _mm512_broadcast_i32x8(b); // DQ
  20. v_uint32x16 e(d); e = e << 10;
  21. __m512i f = _mm512_packus_epi32(d,d);
  22. #if defined __GNUC__ && defined __x86_64__
  23. asm volatile ("" : : : "zmm16", "zmm17", "zmm18", "zmm19");
  24. #endif
  25. }
  26. #else
  27. #error "AVX512-SKX is not supported"
  28. #endif
  29. int main() { return 0; }