Add initial support for MCST Elbrus 2000 (e2k) CPU architecture
patch by: @r-a-sattarov Reviewed by: @Stan Fixes #5877, Refs #5869 Differential Revision: https://code.wildfiregames.com/D3162 This was SVN commit r24490.
This commit is contained in:
parent
d28d17e96c
commit
1bb336829d
@ -210,6 +210,7 @@
|
||||
{ "nick": "Raj", "name": "Raj Sharma" },
|
||||
{ "nick": "ramtzok1", "name": "Ram" },
|
||||
{ "nick": "rapidelectron", "name": "Christian Weihsbach" },
|
||||
{ "nick": "r-a-sattarov", "name": "Ramil Sattarov" },
|
||||
{ "nick": "RedFox", "name": "Jorma Rebane" },
|
||||
{ "nick": "RefinedCode" },
|
||||
{ "nick": "Riemer" },
|
||||
|
@ -83,6 +83,8 @@ else
|
||||
arch = "arm"
|
||||
elseif string.find(machine, "aarch64") == 1 then
|
||||
arch = "aarch64"
|
||||
elseif string.find(machine, "e2k") == 1 then
|
||||
arch = "e2k"
|
||||
else
|
||||
print("WARNING: Cannot determine architecture from GCC, assuming x86")
|
||||
end
|
||||
@ -858,6 +860,8 @@ function setup_all_libs ()
|
||||
table.insert(source_dirs, "lib/sysdep/arch/arm");
|
||||
elseif arch == "aarch64" then
|
||||
table.insert(source_dirs, "lib/sysdep/arch/aarch64");
|
||||
elseif arch == "e2k" then
|
||||
table.insert(source_dirs, "lib/sysdep/arch/e2k");
|
||||
end
|
||||
|
||||
-- OS-specific
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@ -33,7 +33,7 @@
|
||||
#ifndef BYTE_ORDER
|
||||
# define LITTLE_ENDIAN 0x4321
|
||||
# define BIG_ENDIAN 0x1234
|
||||
# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__)
|
||||
# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || defined(__LITTLE_ENDIAN__)
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
# else
|
||||
# define BYTE_ORDER BIG_ENDIAN
|
||||
|
@ -37,6 +37,8 @@ bool HostHasSSE()
|
||||
{
|
||||
#if ARCH_X86_X64
|
||||
return x86_x64::Cap(x86_x64::CAP_SSE);
|
||||
#elif ARCH_E2K
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@ -70,9 +70,15 @@
|
||||
#else
|
||||
# define ARCH_MIPS 0
|
||||
#endif
|
||||
// .. E2K (MCST Elbrus 2000)
|
||||
#if defined(__e2k__)
|
||||
# define ARCH_E2K 1
|
||||
#else
|
||||
# define ARCH_E2K 0
|
||||
#endif
|
||||
|
||||
// ensure exactly one architecture has been detected
|
||||
#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS) != 1
|
||||
#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS+ARCH_E2K) != 1
|
||||
# error "architecture not correctly detected (either none or multiple ARCH_* defined)"
|
||||
#endif
|
||||
|
||||
|
49
source/lib/sysdep/arch/e2k/e2k.cpp
Normal file
49
source/lib/sysdep/arch/e2k/e2k.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Routines specific to E2K (MCST Elbrus 2000)
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "lib/sysdep/cpu.h"
|
||||
|
||||
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
|
||||
{
|
||||
return __sync_fetch_and_add(location, increment);
|
||||
}
|
||||
|
||||
bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue)
|
||||
{
|
||||
return __sync_bool_compare_and_swap(location, expected, newValue);
|
||||
}
|
||||
|
||||
bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue)
|
||||
{
|
||||
return __sync_bool_compare_and_swap(location, expected, newValue);
|
||||
}
|
||||
|
||||
const char* cpu_IdentifierString()
|
||||
{
|
||||
return __builtin_cpu_name();
|
||||
}
|
@ -42,12 +42,18 @@
|
||||
#else
|
||||
# define ICC_VERSION 0
|
||||
#endif
|
||||
// .. LCC (VC-compatible)
|
||||
#if defined(__LCC__)
|
||||
// .. LCC (Win32) and MCST LCC (E2K) compilers define same identifier (__LCC__).
|
||||
#if defined(__LCC__) && !defined(__e2k__)
|
||||
# define LCC_VERSION __LCC__
|
||||
#else
|
||||
# define LCC_VERSION 0
|
||||
#endif
|
||||
// .. MCST LCC (eLbrus C/C++ Compiler)
|
||||
#if defined(__LCC__) && defined(__e2k__)
|
||||
# define MCST_LCC_VERSION (__LCC__*100 + __LCC_MINOR__)
|
||||
#else
|
||||
# define MCST_LCC_VERSION 0
|
||||
#endif
|
||||
// .. GCC
|
||||
#ifdef __GNUC__
|
||||
# define GCC_VERSION (__GNUC__*100 + __GNUC_MINOR__)
|
||||
|
@ -181,6 +181,7 @@ void RunHardwareDetection()
|
||||
scriptInterface.SetProperty(settings, "arch_amd64", ARCH_AMD64);
|
||||
scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM);
|
||||
scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64);
|
||||
scriptInterface.SetProperty(settings, "arch_e2k", ARCH_E2K);
|
||||
|
||||
#ifdef NDEBUG
|
||||
scriptInterface.SetProperty(settings, "build_debug", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user