Skip to content

Commit c0a26a8

Browse files
committed
E2K: added initial support of MCST Elbrus 2000 CPU architecture
1 parent 5a4d0b7 commit c0a26a8

File tree

16 files changed

+69
-48
lines changed

16 files changed

+69
-48
lines changed

engine/baseclient.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,13 @@ bool CBaseClient::SendServerInfo( void )
706706

707707
serverinfo.WriteToBuffer( msg );
708708

709+
#ifndef SWDS
709710
if ( IsX360() && serverinfo.m_nMaxClients > 1 )
710711
{
711712
Msg( "Telling clients to connect" );
712713
g_pMatchmaking->TellClientsToConnect();
713714
}
715+
#endif
714716

715717
// send first tick
716718
m_nSignonTick = m_Server->m_nTickCount;

engine/common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@ COM_ExplainDisconnection
9797
*/
9898
void COM_ExplainDisconnection( bool bPrint, const char *fmt, ... )
9999
{
100+
#ifndef SWDS
100101
if ( IsX360() )
101102
{
102103
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
103104
}
104105
else
106+
#endif
105107
{
106108
va_list argptr;
107109
char string[1024];
@@ -146,11 +148,13 @@ COM_ExtendedExplainDisconnection
146148
*/
147149
void COM_ExtendedExplainDisconnection( bool bPrint, const char *fmt, ... )
148150
{
151+
#ifndef SWDS
149152
if ( IsX360() )
150153
{
151154
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
152155
}
153156
else
157+
#endif
154158
{
155159
va_list argptr;
156160
char string[1024];

engine/l_studio.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4360,13 +4360,14 @@ ModelInstanceHandle_t CModelRender::CreateInstance( IClientRenderable *pRenderab
43604360
// builds out color meshes or loads disk colors, now at load/create time
43614361
RecomputeStaticLighting( handle );
43624362
}
4363-
else
4364-
if ( r_decalstaticprops.GetBool() && instance.m_LightCacheHandle )
4365-
{
4366-
instance.m_AmbientLightingState = *(LightcacheGetStatic( *pCache, NULL, LIGHTCACHEFLAGS_STATIC ));
4367-
}
4363+
#ifndef SWDS
4364+
else if ( r_decalstaticprops.GetBool() && instance.m_LightCacheHandle )
4365+
{
4366+
instance.m_AmbientLightingState = *(LightcacheGetStatic( *pCache, NULL, LIGHTCACHEFLAGS_STATIC ));
4367+
}
4368+
#endif
43684369
}
4369-
4370+
43704371
return handle;
43714372
}
43724373

mathlib/mathlib_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3281,7 +3281,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
32813281
{
32823282
s_bSSEEnabled = true;
32833283

3284-
#ifndef PLATFORM_WINDOWS_PC64
3284+
#if !defined(PLATFORM_WINDOWS_PC64) && (defined(__i386__) || defined(__amd64__))
32853285
// These are not yet available.
32863286
// Select the SSE specific routines if available
32873287
pfVectorNormalize = _VectorNormalize;

mathlib/sse.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "sse2neon.h"
1616
#endif
1717

18+
#if !defined(__e2k__)
19+
1820
#include "sse.h"
1921

2022
// memdbgon must be the last include file in a .cpp file!!!
@@ -1127,3 +1129,5 @@ vec_t DotProduct (const vec_t *a, const vec_t *c)
11271129
*/
11281130

11291131
#endif // COMPILER_MSVC64
1132+
1133+
#endif // !defined(__e2k__)

public/materialsystem/imesh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n )
11521152
//-----------------------------------------------------------------------------
11531153
inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex )
11541154
{
1155-
#if defined(__arm__) || defined(__aarch64__) || defined(PLATFORM_WINDOWS_PC64)
1155+
#if defined(__arm__) || defined(__aarch64__) || defined(__e2k__) || defined(PLATFORM_WINDOWS_PC64)
11561156
FastVertexSSE( vertex );
11571157
#else
11581158
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
@@ -1354,7 +1354,7 @@ inline void CVertexBuilder::Fast4VerticesSSE(
13541354

13551355
inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex )
13561356
{
1357-
#if defined(__arm__) || defined(__aarch64__) || defined(PLATFORM_WINDOWS_PC64)
1357+
#if defined(__arm__) || defined(__aarch64__) || defined(__e2k__) || defined(PLATFORM_WINDOWS_PC64)
13581358
FastVertexSSE( vertex );
13591359
#else
13601360
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed

public/mathlib/mathlib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,8 @@ FORCEINLINE int RoundFloatToInt(float f)
12011201
};
12021202
flResult = __fctiw( f );
12031203
return pResult[1];
1204-
#elif defined (__arm__) || defined (__aarch64__)
1205-
return (int)(f + 0.5f);
1204+
#elif defined(__arm__) || defined(__aarch64__) || defined(__e2k__)
1205+
return (int)(f + 0.5f);
12061206
#else
12071207
#error Unknown architecture
12081208
#endif
@@ -1233,8 +1233,8 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
12331233
Assert( pIntResult[1] >= 0 );
12341234
return pResult[1];
12351235
#else // !X360
1236-
#if defined(__arm__) || defined(__aarch64__)
1237-
return (unsigned long)(f + 0.5f);
1236+
#if defined(__arm__) || defined(__aarch64__) || defined(__e2k__)
1237+
return (unsigned long)(f + 0.5f);
12381238
#elif defined( PLATFORM_WINDOWS_PC64 )
12391239
uint nRet = ( uint ) f;
12401240
if ( nRet & 1 )

public/steam/steamtypes.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ typedef unsigned char uint8;
2424
#define POSIX 1
2525
#endif
2626

27-
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
28-
#define X64BITS
29-
#endif
30-
3127
// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.
3228
#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3)
3329
#define VALVE_BIG_ENDIAN
@@ -48,7 +44,7 @@ typedef unsigned __int64 uint64;
4844
typedef int64 lint64;
4945
typedef uint64 ulint64;
5046

51-
#ifdef X64BITS
47+
#ifdef PLATFORM_64BITS
5248
typedef __int64 intp; // intp is an integer that can accomodate a pointer
5349
typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
5450
#else
@@ -74,7 +70,7 @@ typedef unsigned long long uint64;
7470
typedef long int lint64;
7571
typedef unsigned long int ulint64;
7672

77-
#ifdef X64BITS
73+
#ifdef PLATFORM_64BITS
7874
typedef long long intp;
7975
typedef unsigned long long uintp;
8076
#else

public/tier0/platform.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
#ifndef PLATFORM_H
1010
#define PLATFORM_H
1111

12-
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
12+
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__) || defined(__e2k__)
1313
#define PLATFORM_64BITS 1
1414
#endif
1515

1616
#if defined(__GCC__) || defined(__GNUC__)
1717
#define COMPILER_GCC 1
1818
#endif
1919

20+
#if defined(__LCC__) && defined(__MCST__)
21+
// MCST LCC (eLbrus Compiler Collection)
22+
#define COMPILER_MCST_LCC 1
23+
#endif
24+
2025
#ifdef __GLIBC__
2126
#define PLATFORM_GLIBC 1
2227
#endif
@@ -898,7 +903,7 @@ static FORCEINLINE double fsel(double fComparand, double fValGE, double fLT)
898903

899904
#endif
900905
#endif
901-
#elif defined (__arm__) || defined (__aarch64__)
906+
#elif defined(__arm__) || defined(__aarch64__) || defined(__e2k__)
902907
inline void SetupFPUControlWord() {}
903908
#else
904909
inline void SetupFPUControlWord()
@@ -1069,7 +1074,7 @@ inline T QWordSwapC( T dw )
10691074
// The typically used methods.
10701075
//-------------------------------------
10711076

1072-
#if (defined(__i386__) || defined(__amd64__) || defined(__arm__) || defined(__aarch64__)) && !defined(VALVE_LITTLE_ENDIAN)
1077+
#if (defined(__i386__) || defined(__amd64__) || defined(__arm__) || defined(__aarch64__) || defined(__e2k__)) && !defined(VALVE_LITTLE_ENDIAN)
10731078
#define VALVE_LITTLE_ENDIAN 1
10741079
#endif
10751080

@@ -1235,7 +1240,7 @@ PLATFORM_INTERFACE struct tm * Plat_localtime( const time_t *timep, struct tm *
12351240

12361241
inline uint64 Plat_Rdtsc()
12371242
{
1238-
#if (defined( __arm__ ) || defined( __aarch64__ )) && defined (POSIX)
1243+
#if (defined( __arm__ ) || defined( __aarch64__ ) || defined(__e2k__)) && defined (POSIX)
12391244
struct timespec t;
12401245
clock_gettime( CLOCK_REALTIME, &t);
12411246
return t.tv_sec * 1000000000ULL + t.tv_nsec;

scripts/waifulib/compiler_optimizations.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
'''
3232

33-
VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
33+
VALID_BUILD_TYPES = ['native','fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
3434

3535
LINKFLAGS = {
3636
'common': {
@@ -65,6 +65,12 @@
6565
'clang': ['-O2', '-march=native'],
6666
'default': ['-O3']
6767
},
68+
'native': {
69+
'msvc': ['/O2', '/Oy', '/MT'],
70+
'gcc': ['-O2', '-march=native'],
71+
'clang': ['-O2', '-march=native'],
72+
'default': ['-O3']
73+
},
6874
'release': {
6975
'msvc': ['/O2', '/MT'],
7076
'owcc': ['-O3', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-finline-functions', '-finline-limit=512'],

0 commit comments

Comments
 (0)