linux required changes

This commit is contained in:
marauder2k7 2026-02-27 14:41:37 +00:00
parent d8b511bbf9
commit fa7a8df3aa
3 changed files with 14 additions and 3 deletions

View file

@ -47,7 +47,7 @@ namespace math_backend::float3
{
f32x4 va = v_load3(a);
f32x4 vb = v_load3(b);
f32x4 vr = v_div(va, vb);
f32x4 vr = v_div_fast(va, vb);
v_store3(r, vr);
}
@ -56,7 +56,7 @@ namespace math_backend::float3
{
f32x4 va = v_load3(a);
f32x4 vs = v_set1(s);
f32x4 vr = v_div(va, vs);
f32x4 vr = v_div_fast(va, vs);
v_store3(r, vr);
}

View file

@ -28,8 +28,16 @@ namespace
// Element-wise multiply
inline f32x4 v_mul(f32x4 a, f32x4 b) { return _mm_mul_ps(a, b); }
// Element-wise divide fast (1/b)
inline f32x4 v_div_fast(f32x4 a, f32x4 b)
{
f32x4 rcp = _mm_rcp_ps(b);
// Optional refinement here
return _mm_mul_ps(a, rcp);
}
// Element-wise divide
inline f32x4 v_div(f32x4 a, f32x4 b) { return _mm_div_ps(a, b); }
inline f32x4 v_div(f32x4 a, f32x4 b) { return v_div_fast(a, b); }
// Element-wise add
inline f32x4 v_add(f32x4 a, f32x4 b) { return _mm_add_ps(a, b); }

View file

@ -27,6 +27,7 @@
#include "math/mMath.h"
#include "core/strings/stringFunctions.h"
#include "console/engineAPI.h"
#include "math/public/math_backend.h"
extern void mInstallLibrary_C();
extern void mInstallLibrary_ASM();
@ -90,6 +91,8 @@ void Math::init(U32 properties)
Con::printf(" Installing Standard C extensions");
mInstallLibrary_C();
math_backend::install_from_cpu_flags(properties);
#if defined(TORQUE_CPU_X32) || defined(TORQUE_CPU_X64)
Con::printf(" Installing Assembly extensions");
mInstallLibrary_ASM();