build: arm target support

This commit is contained in:
nillerusr
2021-04-25 23:36:09 +03:00
parent e794dbcbb1
commit 50a93ce91a
51 changed files with 8210 additions and 4386 deletions
+6 -7
View File
@@ -458,11 +458,7 @@ void inline SinCos( float radians, float *sine, float *cosine )
*sine = sin( radians );
*cosine = cos( radians );
#elif defined( POSIX )
double __cosr, __sinr;
__asm ("fsincos" : "=t" (__cosr), "=u" (__sinr) : "0" (radians));
*sine = __sinr;
*cosine = __cosr;
sincosf(radians, sine, cosine);
#endif
}
@@ -1217,6 +1213,8 @@ FORCEINLINE int RoundFloatToInt(float f)
};
flResult = __fctiw( f );
return pResult[1];
#elif defined (__arm__)
return (int)(f + 0.5f);
#else
#error Unknown architecture
#endif
@@ -1247,8 +1245,9 @@ FORCEINLINE unsigned long RoundFloatToUnsignedLong(float f)
Assert( pIntResult[1] >= 0 );
return pResult[1];
#else // !X360
#if defined( PLATFORM_WINDOWS_PC64 )
#ifdef __arm__
return (unsigned long)(f + 0.5f);
#elif defined( PLATFORM_WINDOWS_PC64 )
uint nRet = ( uint ) f;
if ( nRet & 1 )
{
+3 -1
View File
@@ -8,6 +8,8 @@
#if defined( _X360 )
#include <xboxmath.h>
#elif defined(__arm__)
#include "sse2neon.h"
#else
#include <xmmintrin.h>
#endif
@@ -21,7 +23,7 @@
#define USE_STDC_FOR_SIMD 0
#endif
#if (!defined(_X360) && (USE_STDC_FOR_SIMD == 0))
#if (!defined (__arm__) && !defined(_X360) && (USE_STDC_FOR_SIMD == 0))
#define _SSE1 1
#endif
+5 -5
View File
@@ -22,7 +22,8 @@
// For rand(). We really need a library!
#include <stdlib.h>
#ifndef _X360
#if defined(__SSE__) || defined(_M_IX86_FP)
#define USE_SSE
// For MMX intrinsics
#include <xmmintrin.h>
#endif
@@ -209,10 +210,9 @@ private:
FORCEINLINE void NetworkVarConstruct( Vector &v ) { v.Zero(); }
#define USE_M64S ( ( !defined( _X360 ) ) )
#ifdef USE_SSE
#define USE_M64S
#endif
//=========================================================
// 4D Short Vector (aligned on 8-byte boundary)
+11 -5
View File
@@ -16,7 +16,7 @@
#include <math.h>
#include <stdlib.h> // For rand(). We really need a library!
#include <float.h>
#if !defined( _X360 )
#if defined(__SSE__) || defined(_M_IX86_FP)
#include <xmmintrin.h> // For SSE
#endif
#include "basetypes.h" // For vec_t, put this somewhere else?
@@ -141,8 +141,10 @@ public:
inline void Set( vec_t X, vec_t Y, vec_t Z, vec_t W );
inline void InitZero( void );
#ifndef __arm__
inline __m128 &AsM128() { return *(__m128*)&x; }
inline const __m128 &AsM128() const { return *(const __m128*)&x; }
#endif
private:
// No copy constructors allowed if we're in optimal mode
@@ -613,8 +615,10 @@ inline void Vector4DAligned::Set( vec_t X, vec_t Y, vec_t Z, vec_t W )
}
inline void Vector4DAligned::InitZero( void )
{
#if !defined( _X360 )
{
#if defined (__arm__)
x = y = z = w = 0;
#elif !defined( _X360 )
this->AsM128() = _mm_set1_ps( 0.0f );
#else
this->AsM128() = __vspltisw( 0 );
@@ -625,7 +629,7 @@ inline void Vector4DAligned::InitZero( void )
inline void Vector4DMultiplyAligned( Vector4DAligned const& a, Vector4DAligned const& b, Vector4DAligned& c )
{
Assert( a.IsValid() && b.IsValid() );
#if !defined( _X360 )
#if !defined( _X360 ) || defined (__arm__)
c.x = a.x * b.x;
c.y = a.y * b.y;
c.z = a.z * b.z;
@@ -639,7 +643,7 @@ inline void Vector4DWeightMAD( vec_t w, Vector4DAligned const& vInA, Vector4DAli
{
Assert( vInA.IsValid() && vInB.IsValid() && IsFinite(w) );
#if !defined( _X360 )
#if !defined( _X360 ) || defined (__arm__)
vOutA.x += vInA.x * w;
vOutA.y += vInA.y * w;
vOutA.z += vInA.z * w;
@@ -660,6 +664,7 @@ inline void Vector4DWeightMAD( vec_t w, Vector4DAligned const& vInA, Vector4DAli
#endif
}
#ifndef __arm__
inline void Vector4DWeightMADSSE( vec_t w, Vector4DAligned const& vInA, Vector4DAligned& vOutA, Vector4DAligned const& vInB, Vector4DAligned& vOutB )
{
Assert( vInA.IsValid() && vInB.IsValid() && IsFinite(w) );
@@ -681,6 +686,7 @@ inline void Vector4DWeightMADSSE( vec_t w, Vector4DAligned const& vInA, Vector4D
vOutB.AsM128() = __vmaddfp( vInB.AsM128(), temp, vOutB.AsM128() );
#endif
}
#endif
#endif // VECTOR4D_H