Skip to content

Commit

Permalink
dispatch: only include cpuid header when on x86_64
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwer committed Nov 8, 2023
1 parent c513d5f commit d12a2a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <iostream>
#include <memory>

#include <cpuid.h>

#ifdef __x86_64__
#include <cpuid.h>
#include <afvec/vectorclass.h>
#include <afvec/vectormath_trig.h>
#endif
Expand All @@ -24,6 +24,7 @@ enum instruction_t : int { Scalar = 0, SSE4 = 1, AVX2 = 2, AVX512 = 3 };

instruction_t get_current_capability() noexcept {
instruction_t ilvl = Scalar;
#ifdef __x86_64__
unsigned eax, ebx, ecx, edx, flag = 0;
int cpuidret = __get_cpuid(1, &eax, &ebx, &ecx, &edx);

Expand All @@ -43,7 +44,7 @@ instruction_t get_current_capability() noexcept {

if (ebx & bit_AVX2)
return AVX2;

#endif
return ilvl;
}

Expand Down

0 comments on commit d12a2a6

Please sign in to comment.