Skip to content

Commit

Permalink
phintrin correct availability checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s committed Sep 15, 2024
1 parent 38f1379 commit 9eef255
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phlib/include/phintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ extern long __isa_enabled;

#ifdef _M_IX86
#define PhHasIntrinsics \
FlagOn(__isa_enabled, ISA_ENABLED_SSE2)
(__isa_available >= ISA_AVAILABLE_SSE2)
#else
#define PhHasIntrinsics TRUE
#endif
#define PhHasPopulationCount \
FlagOn(__isa_enabled, ISA_ENABLED_SSE42)
(__isa_available >= ISA_AVAILABLE_SSE42)
#define PhHasAVX \
FlagOn(__isa_enabled, ISA_ENABLED_AVX2)
(__isa_available >= ISA_AVAILABLE_AVX2)
#endif

FORCEINLINE
Expand Down

1 comment on commit 9eef255

@jxy-s
Copy link
Member Author

@jxy-s jxy-s commented on 9eef255 Sep 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for x86 is /arch:SSE2, so we could likely remove or default to #define PhHasIntrinsics TRUE always. But this commit was not intended to address that, just correct the availability checks that were already there. Specifically, PhHasAVX was not correctly enabling the AVX2 optimizations when __isa_enabled only specified ISA_ENABLED_AVX512 availability, which would include AVX2.

Please sign in to comment.