mirror of
https://github.com/yuzu-mirror/oaknut.git
synced 2025-12-06 07:01:59 +01:00
oaknut: tests: Only run arm64-specific tests on arm64
This commit is contained in:
parent
8395b79cf2
commit
496ff1b546
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
#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"
|
||||
|
||||
|
|
@ -69,3 +73,5 @@ TEST_CASE("Print CPU features (Using CPUID)")
|
|||
}
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
6
tests/architecture.hpp
Normal file
6
tests/architecture.hpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright (c) 2024 merryhime <https://mary.rs>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#if defined(__ARM64__) || defined(__aarch64__) || defined(_M_ARM64)
|
||||
# define ON_ARM64
|
||||
#endif
|
||||
|
|
@ -7,14 +7,18 @@
|
|||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "oaknut/code_block.hpp"
|
||||
#include "oaknut/dual_code_block.hpp"
|
||||
#include "architecture.hpp"
|
||||
#include "oaknut/oaknut.hpp"
|
||||
#include "rand_int.hpp"
|
||||
|
||||
using namespace oaknut;
|
||||
using namespace oaknut::util;
|
||||
|
||||
#ifdef ON_ARM64
|
||||
|
||||
# include "oaknut/code_block.hpp"
|
||||
# include "oaknut/dual_code_block.hpp"
|
||||
|
||||
TEST_CASE("Basic Test")
|
||||
{
|
||||
CodeBlock mem{4096};
|
||||
|
|
@ -196,19 +200,6 @@ TEST_CASE("ADR", "[slow]")
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE("PageOffset (rollover)")
|
||||
{
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0000000088e74000, 0xffffffffd167dece) == 0xd2202);
|
||||
}
|
||||
|
||||
TEST_CASE("PageOffset (page boundary)")
|
||||
{
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000002, 0x0001000000000001) == 0);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000001, 0x0001000000000002) == 0);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000001000, 0x0001000000000fff) == 0x1fffff);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000fff, 0x0001000000001000) == 0x080000);
|
||||
}
|
||||
|
||||
TEST_CASE("ADRP", "[slow]")
|
||||
{
|
||||
CodeBlock mem{4096};
|
||||
|
|
@ -325,3 +316,18 @@ TEST_CASE("MOVP2R (4GiB boundary)")
|
|||
test(-i);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TEST_CASE("PageOffset (rollover)")
|
||||
{
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0000000088e74000, 0xffffffffd167dece) == 0xd2202);
|
||||
}
|
||||
|
||||
TEST_CASE("PageOffset (page boundary)")
|
||||
{
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000002, 0x0001000000000001) == 0);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000001, 0x0001000000000002) == 0);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000001000, 0x0001000000000fff) == 0x1fffff);
|
||||
REQUIRE(PageOffset<21, 12>::encode(0x0001000000000fff, 0x0001000000001000) == 0x080000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "architecture.hpp"
|
||||
|
||||
#ifdef ON_ARM64
|
||||
|
||||
# include "oaknut/code_block.hpp"
|
||||
# include "oaknut/oaknut.hpp"
|
||||
# include "rand_int.hpp"
|
||||
|
|
@ -83,3 +87,5 @@ TEST_CASE("Fibonacci (VectorCodeGenerator)")
|
|||
REQUIRE(fib(5) == 5);
|
||||
REQUIRE(fib(9) == 34);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue