mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Add support for Neon.
This commit is contained in:
parent
7cb306b65a
commit
960ea2aa5a
2 changed files with 16 additions and 4 deletions
|
|
@ -80,6 +80,7 @@ enum ProcessorProperties
|
||||||
CPU_PROP_MP = (1<<11), ///< This is a multi-processor system.
|
CPU_PROP_MP = (1<<11), ///< This is a multi-processor system.
|
||||||
CPU_PROP_LE = (1<<12), ///< This processor is LITTLE ENDIAN.
|
CPU_PROP_LE = (1<<12), ///< This processor is LITTLE ENDIAN.
|
||||||
CPU_PROP_64bit = (1<<13), ///< This processor is 64-bit capable
|
CPU_PROP_64bit = (1<<13), ///< This processor is 64-bit capable
|
||||||
|
CPU_PROP_NEON = (1<<14), ///< Supports the Arm Neon instruction set extension.
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Processor info manager.
|
/// Processor info manager.
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,11 @@ static void detectCpuFeatures(U32 &procflags)
|
||||||
int err;
|
int err;
|
||||||
U32 lraw;
|
U32 lraw;
|
||||||
|
|
||||||
|
// All Cpus have fpu
|
||||||
|
procflags = CPU_PROP_FPU;
|
||||||
|
|
||||||
|
#if defined(TORQUE_CPU_X86) || defined(TORQUE_CPU_X64)
|
||||||
|
|
||||||
// List of chip-specific features
|
// List of chip-specific features
|
||||||
err = _getSysCTLvalue<U32>("hw.optional.mmx", &lraw);
|
err = _getSysCTLvalue<U32>("hw.optional.mmx", &lraw);
|
||||||
if ((err==0)&&(lraw==1))
|
if ((err==0)&&(lraw==1))
|
||||||
|
|
@ -119,6 +124,12 @@ static void detectCpuFeatures(U32 &procflags)
|
||||||
err = _getSysCTLvalue<U32>("hw.optional.avx1_0", &lraw);
|
err = _getSysCTLvalue<U32>("hw.optional.avx1_0", &lraw);
|
||||||
if ((err==0)&&(lraw==1))
|
if ((err==0)&&(lraw==1))
|
||||||
procflags |= CPU_PROP_AVX;
|
procflags |= CPU_PROP_AVX;
|
||||||
|
|
||||||
|
#elif defined(TORQUE_CPU_ARM64)
|
||||||
|
// All Apple Cpus have Neon
|
||||||
|
procflags |= CPU_PROP_NEON;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
err = _getSysCTLvalue<U32>("hw.ncpu", &lraw);
|
err = _getSysCTLvalue<U32>("hw.ncpu", &lraw);
|
||||||
if ((err==0)&&(lraw>1))
|
if ((err==0)&&(lraw>1))
|
||||||
|
|
@ -129,12 +140,11 @@ static void detectCpuFeatures(U32 &procflags)
|
||||||
err = _getSysCTLvalue<U32>("hw.byteorder", &lraw);
|
err = _getSysCTLvalue<U32>("hw.byteorder", &lraw);
|
||||||
if ((err==0)&&(lraw==1234))
|
if ((err==0)&&(lraw==1234))
|
||||||
procflags |= CPU_PROP_LE;
|
procflags |= CPU_PROP_LE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Processor::init()
|
void Processor::init()
|
||||||
{
|
{
|
||||||
U32 procflags;
|
U32 procflags = 0;
|
||||||
int err, cpufam, cputype, cpusub;
|
int err, cpufam, cputype, cpusub;
|
||||||
char buf[255];
|
char buf[255];
|
||||||
U32 lraw;
|
U32 lraw;
|
||||||
|
|
@ -170,7 +180,6 @@ void Processor::init()
|
||||||
}
|
}
|
||||||
Platform::SystemInfo.processor.mhz = (unsigned int)llraw;
|
Platform::SystemInfo.processor.mhz = (unsigned int)llraw;
|
||||||
|
|
||||||
procflags = CPU_PROP_FPU;
|
|
||||||
detectCpuFeatures(procflags);
|
detectCpuFeatures(procflags);
|
||||||
|
|
||||||
Platform::SystemInfo.processor.properties = procflags;
|
Platform::SystemInfo.processor.properties = procflags;
|
||||||
|
|
@ -197,7 +206,9 @@ void Processor::init()
|
||||||
Con::printf(" SSE4.2 detected");
|
Con::printf(" SSE4.2 detected");
|
||||||
if (Platform::SystemInfo.processor.properties & CPU_PROP_AVX)
|
if (Platform::SystemInfo.processor.properties & CPU_PROP_AVX)
|
||||||
Con::printf(" AVX detected");
|
Con::printf(" AVX detected");
|
||||||
|
if (Platform::SystemInfo.processor.properties & CPU_PROP_NEON)
|
||||||
|
Con::printf(" Neon detected");
|
||||||
|
|
||||||
Con::printf( "" );
|
Con::printf( "" );
|
||||||
|
|
||||||
// Trigger the signal
|
// Trigger the signal
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue