Skip to content

Commit

Permalink
Tighten test for intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Dec 9, 2023
1 parent 62d706d commit c239cfa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/openjp2/ht_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@
#define OPJ_COMPILER_GNUC
#endif

#if defined(OPJ_COMPILER_MSVC) && defined(_M_ARM64)
#if defined(OPJ_COMPILER_MSVC) && defined(_M_ARM64) \
&& !defined(_M_ARM64EC) && !defined(_M_CEE_PURE) && !defined(__CUDACC__) \
&& !defined(__INTEL_COMPILER) && !defined(__clang__)
#define MSVC_NEON_INTRINSICS
#endif

#ifdef MSVC_NEON_INTRINSICS
#include <arm64_neon.h>
#endif

Expand All @@ -75,7 +81,7 @@ OPJ_UINT32 population_count(OPJ_UINT32 val)
{
#if defined(OPJ_COMPILER_MSVC) && (defined(_M_IX86) || defined(_M_AMD64))
return (OPJ_UINT32)__popcnt(val);
#elif defined(OPJ_COMPILER_MSVC) && defined(_M_ARM64)
#elif defined(OPJ_COMPILER_MSVC) && defined(MSVC_NEON_INTRINSICS)
const __n64 temp = neon_cnt(__uint64ToN64_v(val));
return neon_addv8(temp).n8_i8[0];
#elif (defined OPJ_COMPILER_GNUC)
Expand Down

0 comments on commit c239cfa

Please sign in to comment.