[a64] Implement `LSE` and `FP16C` detection
Adds two new flags for allowing the use of LSE and FP16C
This commit is contained in:
parent
96d444da9c
commit
06daedf077
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "oaknut/feature_detection/cpu_feature.hpp"
|
#include "oaknut/feature_detection/cpu_feature.hpp"
|
||||||
#include "oaknut/feature_detection/feature_detection.hpp"
|
#include "oaknut/feature_detection/feature_detection.hpp"
|
||||||
|
#include "oaknut/feature_detection/feature_detection_idregs.hpp"
|
||||||
|
|
||||||
DEFINE_bool(debugprint_trap_log, false,
|
DEFINE_bool(debugprint_trap_log, false,
|
||||||
"Log debugprint traps to the active debugger", "CPU");
|
"Log debugprint traps to the active debugger", "CPU");
|
||||||
|
@ -77,12 +78,30 @@ A64Emitter::A64Emitter(A64Backend* backend)
|
||||||
processor_(backend->processor()),
|
processor_(backend->processor()),
|
||||||
backend_(backend),
|
backend_(backend),
|
||||||
code_cache_(backend->code_cache()) {
|
code_cache_(backend->code_cache()) {
|
||||||
const oaknut::CpuFeatures cpu_ = oaknut::detect_features();
|
oaknut::CpuFeatures cpu_ = oaknut::detect_features();
|
||||||
|
|
||||||
|
// Combine with id register detection
|
||||||
|
#if OAKNUT_SUPPORTS_READING_ID_REGISTERS > 0
|
||||||
|
#if OAKNUT_SUPPORTS_READING_ID_REGISTERS == 1
|
||||||
|
const std::optional<oaknut::id::IdRegisters> id_registers =
|
||||||
|
oaknut::read_id_registers();
|
||||||
|
#elif OAKNUT_SUPPORTS_READING_ID_REGISTERS == 2
|
||||||
|
const std::optional<oaknut::id::IdRegisters> id_registers =
|
||||||
|
oaknut::read_id_registers(0);
|
||||||
|
#endif
|
||||||
|
if (id_registers.has_value()) {
|
||||||
|
cpu_ = cpu_ | oaknut::detect_features_via_id_registers(*id_registers);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TEST_EMIT_FEATURE(emit, ext) \
|
#define TEST_EMIT_FEATURE(emit, ext) \
|
||||||
if ((cvars::a64_extension_mask & emit) == emit) { \
|
if ((cvars::a64_extension_mask & emit) == emit) { \
|
||||||
feature_flags_ |= (cpu_.has(ext) ? emit : 0); \
|
feature_flags_ |= (cpu_.has(ext) ? emit : 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_EMIT_FEATURE(kA64EmitLSE, oaknut::CpuFeature::LSE);
|
||||||
|
TEST_EMIT_FEATURE(kA64EmitF16C, oaknut::CpuFeature::FP16Conv);
|
||||||
|
|
||||||
#undef TEST_EMIT_FEATURE
|
#undef TEST_EMIT_FEATURE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,10 @@ enum VConst {
|
||||||
V2To32,
|
V2To32,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum A64EmitterFeatureFlags {};
|
enum A64EmitterFeatureFlags {
|
||||||
|
kA64EmitLSE = 1 << 0,
|
||||||
|
kA64EmitF16C = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
class A64Emitter : public oaknut::CodeBlock, public oaknut::CodeGenerator {
|
class A64Emitter : public oaknut::CodeBlock, public oaknut::CodeGenerator {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue