Skip to content

Commit

Permalink
Fix bug inadvertently introduced in a1c4c4e
Browse files Browse the repository at this point in the history
  • Loading branch information
sneves committed Feb 13, 2020
1 parent 207915a commit 421a21a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions c/blake3_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ static uint64_t xgetbv() {
static void cpuid(uint32_t out[4], uint32_t id) {
#if defined(_MSC_VER)
__cpuid((int *)out, id);
#else
#if defined(__i386__) || defined(_M_IX86)
#elif defined(__i386__) || defined(_M_IX86)
__asm__ __volatile__("movl %%ebx, %1\n"
"cpuid\n"
"xchgl %1, %%ebx\n"
Expand All @@ -107,18 +106,21 @@ static void cpuid(uint32_t out[4], uint32_t id) {
: "=a"(out[0]), "=b"(out[1]), "=c"(out[2]), "=d"(out[3])
: "a"(id));
#endif
#endif
}

static void cpuidex(uint32_t out[4], uint32_t id, uint32_t sid) {
#if defined(_MSC_VER)
__cpuidex((int *)out, id, sid);
#else
#elif defined(__i386__) || defined(_M_IX86)
__asm__ __volatile__("movl %%ebx, %1\n"
"cpuid\n"
"xchgl %1, %%ebx\n"
: "=a"(out[0]), "=r"(out[1]), "=c"(out[2]), "=d"(out[3])
: "a"(id), "c"(sid));
#else
__asm__ __volatile__("cpuid\n"
: "=a"(out[0]), "=b"(out[1]), "=c"(out[2]), "=d"(out[3])
: "a"(id), "c"(sid));
#endif
}

Expand Down

0 comments on commit 421a21a

Please sign in to comment.