diff --git a/include/SDL3/SDL_intrin.h b/include/SDL3/SDL_intrin.h index 4ee47d735..811047a0e 100644 --- a/include/SDL3/SDL_intrin.h +++ b/include/SDL3/SDL_intrin.h @@ -89,6 +89,8 @@ _m_prefetch(void *__P) # endif #elif defined(__GNUC__) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */ # define SDL_HAS_TARGET_ATTRIBS +#elif defined(__ICC) && __ICC >= 1600 +# define SDL_HAS_TARGET_ATTRIBS #endif #ifdef SDL_HAS_TARGET_ATTRIBS @@ -108,13 +110,14 @@ _m_prefetch(void *__P) #endif #if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) -# if ((defined(__GNUC__) && (__GNUC__ >= 10)) || (defined(__clang__) && __clang_major__ >= 4) || defined(_MSC_VER)) && !defined(SDL_DISABLE_RDTSC) +# if (defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)) || defined(__clang__) || defined(__ICC)) && !defined(SDL_DISABLE_RDTSC) # define SDL_RDTSC_INTRINSICS 1 # if defined(_MSC_VER) # include # else -# include +# include # endif +# define SDL_rdtsc __rdtsc # endif # if ((defined(_MSC_VER) && !defined(_M_X64)) || defined(__MMX__) || defined(SDL_HAS_TARGET_ATTRIBS)) && !defined(SDL_DISABLE_MMX) # define SDL_MMX_INTRINSICS 1 diff --git a/test/testautomation_intrinsics.c b/test/testautomation_intrinsics.c index 2add76957..2819495ca 100644 --- a/test/testautomation_intrinsics.c +++ b/test/testautomation_intrinsics.c @@ -368,11 +368,7 @@ static int intrinsics_testRDTSC(void *arg) { Sint64 ticks; -#if defined(_MSC_VER) || defined(__clang__) - ticks = __rdtsc(); -#else - ticks = _rdtsc(); -#endif + ticks = SDL_rdtsc(); SDLTest_AssertCheck(SDL_TRUE, "rdtsc returned: %" SDL_PRIu64 " ticks", ticks);