CSC icon indicating copy to clipboard operation
CSC copied to clipboard

bad detection of SSE2

Open inikep opened this issue 9 years ago • 2 comments

Prefeching is not working with gcc 4.8.4 (without -msse2): https://travis-ci.org/inikep/lzbench/jobs/167837663

To properly check if <emmintrin.h> is available in gcc you should use:

#ifdef __SSE2__
    #include <emmintrin.h> /* requires SSE2 */
#endif

inikep avatar Oct 15 '16 10:10 inikep

irrespective of this particular implementation

  1. prefetching command is a part of sse1
  2. on older cpus one can use volatile char x = *ptr instead. but it will probably will decrease perfromance on cpus that can't speculatively perform memory access, and useful only for newer cpus (pentium pro/pentium2/amd k6/k7)

Bulat-Ziganshin avatar Oct 15 '16 11:10 Bulat-Ziganshin

True, it's supported from Visual C++ 6.0 and with gcc -msse so this should work:

#if defined(_MSC_VER) || defined(__SSE__)
#  include <xmmintrin.h>
#endif

inikep avatar Oct 28 '16 21:10 inikep