Skip to content

Commit

Permalink
E2K: added initial support of MCST Elbrus 2000 CPU architecture
Browse files Browse the repository at this point in the history
e2k (Elbrus 2000) - this is VLIW/EPIC architecture, like Intel Itanium (IA-64) architecture.
Ref: https://en.wikipedia.org/wiki/Elbrus_2000

Signed-off-by: r-a-sattarov <r.a.sattarov@yandex.ru>
  • Loading branch information
r-a-sattarov committed Nov 11, 2020
1 parent 467be80 commit 409a55f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/lib/OpenEXR/ImfFastHuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ FastHufDecoder::~FastHufDecoder()
bool
FastHufDecoder::enabled()
{
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
#if defined(__INTEL_COMPILER) || defined(__GNUC__)

//
// Enabled for ICC, GCC:
// __i386__ -> x86
// __x86_64__ -> 64-bit x86
//
// __e2k__ -> e2k (Elbrus 2000)

#if defined (__i386__) || defined(__x86_64__)
#if defined (__i386__) || defined(__x86_64__) || defined(__e2k__)
return true;
#else
return false;
Expand Down
37 changes: 31 additions & 6 deletions src/lib/OpenEXR/ImfSystemSpecific.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER

namespace {
#if defined(IMF_HAVE_SSE2) && defined(__GNUC__)
#if defined(IMF_HAVE_SSE2) && defined(__GNUC__) && !defined(__e2k__)

// Helper functions for gcc + SSE enabled
void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
{
__asm__ __volatile__ (
"cpuid"
: /* Output */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
: /* Output */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
: /* Input */ "a"(n)
: /* Clobber */);
}

#else // IMF_HAVE_SSE2 && __GNUC__
#else // IMF_HAVE_SSE2 && __GNUC__ && !__e2k__

// Helper functions for generic compiler - all disabled
void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
{
eax = ebx = ecx = edx = 0;
}

#endif // IMF_HAVE_SSE2 && __GNUC__
#endif // IMF_HAVE_SSE2 && __GNUC__ && !__e2k__


#ifdef IMF_HAVE_GCC_INLINEASM_X86
Expand All @@ -69,7 +69,7 @@ namespace {
{
__asm__ __volatile__ (
"xgetbv"
: /* Output */ "=a"(eax), "=d"(edx)
: /* Output */ "=a"(eax), "=d"(edx)
: /* Input */ "c"(n)
: /* Clobber */);
}
Expand All @@ -83,7 +83,7 @@ namespace {

#endif // IMF_HAVE_GCC_INLINEASM_X86

} // namespace
} // namespace

CpuId::CpuId():
sse2(false),
Expand All @@ -94,6 +94,30 @@ CpuId::CpuId():
avx(false),
f16c(false)
{
#if defined(__e2k__) // e2k - MCST Elbrus 2000 CPU architecture
// Use preprocessor definitions to determine e2k CPU features
# if defined(__SSE2__)
sse2 = true;
# endif
# if defined(__SSE3__)
sse3 = true;
# endif
# if defined(__SSSE3__)
ssse3 = true;
# endif
# if defined(__SSE4_1__)
sse4_1 = true;
# endif
# if defined(__SSE4_2__)
sse4_2 = true;
# endif
# if defined(__AVX__)
avx = true;
# endif
# if defined(__F16C__)
f16c = true;
# endif
#else // x86/x64
bool osxsave = false;
int max = 0;
int eax, ebx, ecx, edx;
Expand Down Expand Up @@ -125,6 +149,7 @@ CpuId::CpuId():
}
}
}
#endif
}

OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT

0 comments on commit 409a55f

Please sign in to comment.