Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Use fallback for PPC64 and s390x #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions FastNoiseSIMD/FastNoiseSIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
#include "ARM/cpu-features.h"
#endif
#else
#if !(defined(__ppc64__) || defined(__PPC64__) || defined(__s390x__))
#include <cpuid.h>
#endif
#include "inttypes.h"
#endif

Expand Down Expand Up @@ -106,6 +108,15 @@ uint64_t xgetbv(unsigned int x) {
return _xgetbv(x);
}
#else
#if defined(__ppc64__) || defined(__PPC64__) || defined(__s390x__)
void cpuid(int32_t out[4], int32_t x) {
/* Just disable it as anything better is unimplemented. */
out[0] = 0;
}
uint64_t xgetbv(unsigned int index) {
return 0;
}
#else
void cpuid(int32_t out[4], int32_t x) {
__cpuid_count(x, 0, out[0], out[1], out[2], out[3]);
}
Expand All @@ -114,6 +125,7 @@ uint64_t xgetbv(unsigned int index) {
__asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
return ((uint64_t)edx << 32) | eax;
}
#endif
#define _XCR_XFEATURE_ENABLED_MASK 0
#endif

Expand Down
2 changes: 1 addition & 1 deletion FastNoiseSIMD/FastNoiseSIMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define FN_ALIGNED_SETS

// SSE2/NEON support is guaranteed on 64bit CPUs so no fallback is needed
#if !(defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__) || defined(FN_IOS)) || defined(_DEBUG)
#if !(defined(_WIN64) || defined(__x86_64__) || defined(__aarch64__) || defined(FN_IOS)) || defined(_DEBUG)
#define FN_COMPILE_NO_SIMD_FALLBACK
#endif

Expand Down