cog/Frameworks/OpenMPT.old/OpenMPT/common/mptCPU.h

78 lines
2.5 KiB
C
Raw Normal View History

2018-02-19 04:25:43 +00:00
/*
* mptCPU.h
* --------
* Purpose: CPU feature detection.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
2019-01-24 02:16:37 +00:00
#include "BuildSettings.h"
2018-02-19 04:25:43 +00:00
OPENMPT_NAMESPACE_BEGIN
#ifdef ENABLE_ASM
2018-02-19 04:25:43 +00:00
2020-09-22 04:54:24 +00:00
#define PROCSUPPORT_ASM_INTRIN 0x00001 // assembly and intrinsics are enabled at runtime
#define PROCSUPPORT_CPUID 0x00002 // Processor supports modern cpuid
#define PROCSUPPORT_LM 0x00004 // Processor supports long mode (amd64)
2018-02-19 04:25:43 +00:00
#define PROCSUPPORT_MMX 0x00010 // Processor supports MMX instructions
#define PROCSUPPORT_SSE 0x00100 // Processor supports SSE instructions
#define PROCSUPPORT_SSE2 0x00200 // Processor supports SSE2 instructions
#define PROCSUPPORT_SSE3 0x00400 // Processor supports SSE3 instructions
#define PROCSUPPORT_SSSE3 0x00800 // Processor supports SSSE3 instructions
#define PROCSUPPORT_SSE4_1 0x01000 // Processor supports SSE4.1 instructions
#define PROCSUPPORT_SSE4_2 0x02000 // Processor supports SSE4.2 instructions
2020-09-22 04:54:24 +00:00
#define PROCSUPPORT_AVX 0x10000 // Processor supports AVX instructions
#define PROCSUPPORT_AVX2 0x20000 // Processor supports AVX2 instructions
2018-02-19 04:25:43 +00:00
#define PROCSUPPORT_NEON 0x40000 // Processor supports NEON instructions
2020-09-22 04:54:24 +00:00
static constexpr uint32 PROCSUPPORT_i586 = 0u ;
static constexpr uint32 PROCSUPPORT_x86_SSE = 0u | PROCSUPPORT_SSE ;
static constexpr uint32 PROCSUPPORT_x86_SSE2 = 0u | PROCSUPPORT_SSE | PROCSUPPORT_SSE2 ;
static constexpr uint32 PROCSUPPORT_AMD64 = 0u | PROCSUPPORT_SSE | PROCSUPPORT_SSE2 | PROCSUPPORT_LM;
static constexpr uint32 PROCSUPPORT_ARM64 = 0u | PROCSUPPORT_NEON ;
2020-09-22 04:54:24 +00:00
2018-02-19 04:25:43 +00:00
extern uint32 RealProcSupport;
extern uint32 ProcSupport;
extern char ProcVendorID[16+1];
2019-01-24 02:16:37 +00:00
extern char ProcBrandID[4*4*3+1];
2021-04-12 00:23:22 +00:00
extern uint32 ProcRawCPUID;
2018-02-19 04:25:43 +00:00
extern uint16 ProcFamily;
extern uint8 ProcModel;
extern uint8 ProcStepping;
void InitProcSupport();
// enabled processor features for inline asm and intrinsics
2020-12-05 00:22:42 +00:00
inline uint32 GetProcSupport()
2018-02-19 04:25:43 +00:00
{
return ProcSupport;
}
// available processor features
2020-12-05 00:22:42 +00:00
inline uint32 GetRealProcSupport()
2018-02-19 04:25:43 +00:00
{
return RealProcSupport;
}
#endif // ENABLE_ASM
#ifdef MODPLUG_TRACKER
uint32 GetMinimumProcSupportFlags();
int GetMinimumSSEVersion();
int GetMinimumAVXVersion();
#endif
OPENMPT_NAMESPACE_END