mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 17:35:46 +00:00
Move dead submodules in-tree
Signed-off-by: swurl <swurl@swurl.xyz>
This commit is contained in:
parent
c0cceff365
commit
6c655321e6
4081 changed files with 1185566 additions and 45 deletions
77
externals/oaknut/tests/_feature_detect.cpp
vendored
Normal file
77
externals/oaknut/tests/_feature_detect.cpp
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
// SPDX-FileCopyrightText: Copyright (c) 2022 merryhime <https://mary.rs>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "architecture.hpp"
|
||||
|
||||
#ifdef ON_ARM64
|
||||
|
||||
# include "oaknut/feature_detection/feature_detection.hpp"
|
||||
# include "oaknut/feature_detection/feature_detection_idregs.hpp"
|
||||
|
||||
using namespace oaknut;
|
||||
|
||||
TEST_CASE("Print CPU features (Default)")
|
||||
{
|
||||
CpuFeatures features = detect_features();
|
||||
|
||||
std::fputs("CPU Features: ", stdout);
|
||||
|
||||
# define OAKNUT_CPU_FEATURE(name) \
|
||||
if (features.has(CpuFeature::name)) \
|
||||
std::fputs(#name " ", stdout);
|
||||
# include "oaknut/impl/cpu_feature.inc.hpp"
|
||||
# undef OAKNUT_CPU_FEATURE
|
||||
|
||||
std::fputs("\n", stdout);
|
||||
}
|
||||
|
||||
# if OAKNUT_SUPPORTS_READING_ID_REGISTERS == 1
|
||||
|
||||
TEST_CASE("Print CPU features (Using CPUID)")
|
||||
{
|
||||
std::optional<id::IdRegisters> id_regs = read_id_registers();
|
||||
REQUIRE(!!id_regs);
|
||||
|
||||
CpuFeatures features = detect_features_via_id_registers(*id_regs);
|
||||
|
||||
std::fputs("CPU Features (CPUID method): ", stdout);
|
||||
|
||||
# define OAKNUT_CPU_FEATURE(name) \
|
||||
if (features.has(CpuFeature::name)) \
|
||||
std::fputs(#name " ", stdout);
|
||||
# include "oaknut/impl/cpu_feature.inc.hpp"
|
||||
# undef OAKNUT_CPU_FEATURE
|
||||
|
||||
std::fputs("\n", stdout);
|
||||
}
|
||||
|
||||
# elif OAKNUT_SUPPORTS_READING_ID_REGISTERS == 2
|
||||
|
||||
TEST_CASE("Print CPU features (Using CPUID)")
|
||||
{
|
||||
const std::size_t core_count = get_core_count();
|
||||
for (std::size_t core_index = 0; core_index < core_count; core_index++) {
|
||||
std::optional<id::IdRegisters> id_regs = read_id_registers(core_index);
|
||||
REQUIRE(!!id_regs);
|
||||
|
||||
CpuFeatures features = detect_features_via_id_registers(*id_regs);
|
||||
|
||||
std::printf("CPU Features (CPUID method - Core %zu): ", core_index);
|
||||
|
||||
# define OAKNUT_CPU_FEATURE(name) \
|
||||
if (features.has(CpuFeature::name)) \
|
||||
std::fputs(#name " ", stdout);
|
||||
# include "oaknut/impl/cpu_feature.inc.hpp"
|
||||
# undef OAKNUT_CPU_FEATURE
|
||||
|
||||
std::fputs("\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue