Skip to content

Commit

Permalink
Revert "Prevent memory reordering"
Browse files Browse the repository at this point in the history
This reverts commit 055e00c.
  • Loading branch information
kimwalisch committed Jun 19, 2024
1 parent 111070e commit 6ffc191
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
1 change: 0 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Changes in primecount-7.14, 2024-06-19

* int128_t.hpp: Rename namespace port to pstd (portable std namespace).
* cpuid.hpp: Prevent memory reordering.
* Sieve.hpp: Tune AVX512 code.
* multiarch_avx512_vpopcnt.cmake: Tune AVX512 code.

Expand Down
28 changes: 12 additions & 16 deletions include/cpuid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,19 @@ inline void run_cpuid(int eax, int ecx, int* abcd)
#if defined(__i386__) && \
defined(__PIC__)
/* in case of PIC under 32-bit EBX cannot be clobbered */
__asm__ __volatile__ (
"movl %%ebx, %%edi;"
"cpuid;"
"xchgl %%ebx, %%edi;"
: "=D" (ebx),
"+a" (eax),
"+c" (ecx),
"=d" (edx)
: "memory"
);
__asm__ ("movl %%ebx, %%edi;"
"cpuid;"
"xchgl %%ebx, %%edi;"
: "=D" (ebx),
"+a" (eax),
"+c" (ecx),
"=d" (edx));
#else
__asm__ __volatile__ (
"cpuid"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (eax), "2" (ecx)
: "memory"
);
__asm__ ("cpuid;"
: "+b" (ebx),
"+a" (eax),
"+c" (ecx),
"=d" (edx));
#endif

abcd[0] = eax;
Expand Down

0 comments on commit 6ffc191

Please sign in to comment.