Update SIMD and Platform Linux.
This commit is contained in:
parent
bb759b1a9a
commit
c65b1c8139
22
.vscode/settings.json
vendored
Normal file
22
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"C_Cpp.formatting": "clangFormat",
|
||||
"C_Cpp.loggingLevel": "Error",
|
||||
"C_Cpp.default.cppStandard": "c++20",
|
||||
"C_Cpp.default.includePath": [
|
||||
"${workspaceFolder}/Engine/Source/Runtime",
|
||||
"${workspaceFolder}/Engine/Source/ThirdParty"
|
||||
],
|
||||
|
||||
"C_Cpp.default.browse.path": [
|
||||
"${workspaceFolder}/Engine/Source/Runtime",
|
||||
"${workspaceFolder}/Engine/Source/ThirdParty"
|
||||
],
|
||||
"C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db",
|
||||
"files.associations": {
|
||||
"cstdint": "cpp"
|
||||
},
|
||||
"C_Cpp.default.defines": [
|
||||
"P_LINUX_BUILD",
|
||||
"__SSE__",
|
||||
],
|
||||
}
|
@ -14,9 +14,9 @@
|
||||
// User defines build platform
|
||||
#ifdef P_WIN_BUILD
|
||||
# define P_PLATFORM P_PLATFORM_WIN
|
||||
# error Windows system is not yet supported.
|
||||
#elif P_LINUX_BUILD
|
||||
# define P_PLATFORM P_PLATFORM_LIN
|
||||
# error Linux / Unix system is not yet supported.
|
||||
#elif P_MAC_BUILD
|
||||
# define P_PLATFORM P_PLATFORM_MAC
|
||||
# error Mac target system is not yet supported.
|
||||
@ -133,7 +133,6 @@
|
||||
// Clang
|
||||
|
||||
#elif (defined(__clang__))
|
||||
# error PhanesEngine only supports MSVC -> Visual Studio
|
||||
# if defined(__apple_build_version__)
|
||||
#
|
||||
# if (__clang_major__ < 6)
|
||||
|
@ -1,30 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "PhanesEnginePCH.h"
|
||||
|
||||
// ============================================= //
|
||||
// Turn os specific types into global types. //
|
||||
// ============================================= //
|
||||
|
||||
|
||||
// TODO: include int128
|
||||
|
||||
namespace Phanes::Core::Types
|
||||
{
|
||||
|
||||
#ifdef P_WIN_BUILD
|
||||
|
||||
// MSCV++ specific types
|
||||
|
||||
typedef FLOAT128 float128;
|
||||
|
||||
//#elif P_UNIX_BUILD
|
||||
//
|
||||
// // GCC specific types
|
||||
//
|
||||
// typedef __float128 float128;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Specific types size
|
||||
//
|
||||
// 8-Bit integer
|
||||
|
@ -28,9 +28,19 @@
|
||||
|
||||
#define FORCEINLINE __forceinline
|
||||
|
||||
#elif defined(P_UNIX_BUILD)
|
||||
#elif defined(P_LINUX_BUILD)
|
||||
|
||||
#error Only Windows is supported at the moment.
|
||||
#ifdef P_DEBUG
|
||||
|
||||
#define P_DEBUGBREAK __builtin_trap();
|
||||
|
||||
#else
|
||||
|
||||
#define P_DEBUGBREAK
|
||||
|
||||
#endif // P_DEBUG
|
||||
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
|
||||
#elif defined(P_ARM_BUILD)
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
# include "PhanesEnginePCH.h"
|
||||
#else
|
||||
# define NOMINMAX
|
||||
# include <Windows.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
@ -113,7 +113,7 @@ namespace Phanes::Core::Math::SIMD
|
||||
/// <param name="v1"></param>
|
||||
void vec3_fix(Phanes::Core::Types::Vec4f32Reg v1)
|
||||
{
|
||||
v1.m128_f32[3] = 0.0f;
|
||||
v1 = _mm_and_ps(v1, _mm_castsi128_ps(_mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ namespace Phanes::Core::Math::Detail
|
||||
static FORCEINLINE float map(const Phanes::Core::Math::TVector4<float, true>& v1)
|
||||
{
|
||||
__m128 tmp = _mm_mul_ps(v1.data, v1.data);
|
||||
return sqrt(tmp.m128_f32[0] + tmp.m128_f32[1] + tmp.m128_f32[2] + tmp.m128_f32[3]);
|
||||
return _mm_cvtss_f32(_mm_sqrt_ps(SIMD::vec4_hadd(tmp)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -515,7 +515,7 @@ namespace Phanes::Core::Math::Detail
|
||||
static FORCEINLINE double map(const Phanes::Core::Math::TVector2<double, true>& v1)
|
||||
{
|
||||
__m128d tmp = _mm_mul_pd(v1.data, v1.data);
|
||||
return sqrt(tmp.m128d_f64[0] + tmp.m128d_f64[1]);
|
||||
return _mm_cvtsd_f64(_mm_sqrt_pd(_mm_hadd_pd(tmp, tmp)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -526,7 +526,7 @@ namespace Phanes::Core::Math::Detail
|
||||
static FORCEINLINE double map(const Phanes::Core::Math::TVector2<double, true>& v1)
|
||||
{
|
||||
__m128d tmp = _mm_mul_pd(v1.data, v1.data);
|
||||
return tmp.m128d_f64[0] + tmp.m128d_f64[1];
|
||||
return _mm_cvtsd_f64(_mm_hadd_pd(tmp, tmp));
|
||||
}
|
||||
};
|
||||
|
||||
@ -657,7 +657,7 @@ namespace Phanes::Core::Math::Detail
|
||||
|
||||
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& v1, const int* comp)
|
||||
{
|
||||
v1.comp = _mm_loadu_epi32(comp);
|
||||
v1.comp = _mm_set_epi32(comp[3], comp[2], comp[1], comp[0]);
|
||||
}
|
||||
|
||||
static FORCEINLINE void map(Phanes::Core::Math::TIntVector4<int, true>& r, const Phanes::Core::Math::TIntVector2<int, true>& v1, const Phanes::Core::Math::TIntVector2<int, true>& v2)
|
||||
@ -875,7 +875,7 @@ namespace Phanes::Core::Math::Detail
|
||||
|
||||
static FORCEINLINE void map(Phanes::Core::Math::TIntVector2<Phanes::Core::Types::int64, true>& v1, const Phanes::Core::Types::int64* comp)
|
||||
{
|
||||
v1.comp = _mm_loadu_epi64(comp);
|
||||
v1.comp = _mm_set_epi64x(comp[1], comp[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
4
MathTestFPU/CMakeLists.txt
Normal file
4
MathTestFPU/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(2.8)
|
||||
|
||||
project(MathTestFPU)
|
||||
|
Loading…
x
Reference in New Issue
Block a user