Skip to content

Commit

Permalink
Better support for different and unknown architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
besser82 committed Apr 30, 2017
1 parent df0eb1c commit 06e1905
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/shogun/lib/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,18 @@ SG_FORCED_INLINE static void CpuRelax()
{
#ifdef _MSC_VER
_mm_pause();
#elif defined(__i386__) || defined(__x86_64__)
asm volatile("pause");
#elif defined(__arm__) || defined(__aarch64__)
asm volatile("yield");
#elif defined(__powerpc__) || defined(__ppc__)
asm volatile("or 27,27,27");
#elif defined(__s390__) || defined(__s390x__)
asm volatile("": : :"memory");
#else
asm("pause");
static uint32_t bar = 13;
static uint32_t *foo = &bar;
for (int i = 0; i < 100000; i++) {*foo = (*foo * 33) + 17;}
#endif
}

Expand Down

0 comments on commit 06e1905

Please sign in to comment.