Files
kobalicek b56f4176cb Codebase update and improvements, instruction DB update
* Denested src folder to root, renamed testing to asmjit-testing

  * Refactored how headers are included into <asmjit/...> form. This
    is necessary as compilers would never simplify a path once a ..
    appears in include directory - then paths such as ../core/../core
    appeared in asserts, which was ugly

  * Moved support utilities into asmjit/support/... (still included
    by asmjit/core.h for convenience and compatibility)

  * Added CMakePresets.json for making it easy to develop AsmJit

  * Reworked CMakeLists to be shorter and use CMake option(),
    etc... This simplifies it and makes it using more standard
    features

  * ASMJIT_EMBED now creates asmjit_embed INTERFACE library,
    which is accessible via asmjit::asmjit target - this simplifies
    embedding and makes it the same as library targets from a CMake
    perspective

  * Removed ASMJIT_DEPS - this is now provided by cmake target
    aliases - 'asmjit::asmjit' so users should not need this variable

  * Changed meaning of ASMJIT_LIBS - this now contains only AsmJit
    dependencies without asmjit::asmjit target alias. Don't rely on
    ASMJIT_LIBS anymore as it's only used internally

  * Removed ASMJIT_NO_DEPRECATED option - AsmJit is not going
    to provide controllable deprecations in the future

  * Removed ASMJIT_NO_VALIDATION in favor of ASMJIT_NO_INTROSPECTION,
    which now controls query, features, and validation API presence

  * Removed ASMJIT_DIR option - it was never really needed

  * Removed AMX_TRANSPOSE feature from instruction database (X86).
    Intel has removed it as well, so it's a feature that won't
    be siliconized
2025-11-02 22:31:46 +01:00

86 lines
2.6 KiB
C++

// This file is part of AsmJit project <https://asmjit.com>
//
// See <asmjit/core.h> or LICENSE.md for license and copyright information
// SPDX-License-Identifier: Zlib
#include <asmjit/core/api-build_p.h>
#if !defined(ASMJIT_NO_AARCH64)
#include <asmjit/core/misc_p.h>
#include <asmjit/arm/a64operand.h>
ASMJIT_BEGIN_SUB_NAMESPACE(a64)
// a64::Operand - Tests
// ====================
#if defined(ASMJIT_TEST)
UNIT(a64_operand) {
INFO("Checking if a64::reg(...) matches built-in IDs");
EXPECT_EQ(w(5), w5);
EXPECT_EQ(x(5), x5);
INFO("Checking Gp register properties");
EXPECT_TRUE(Gp().is_reg());
EXPECT_TRUE(w0.is_reg());
EXPECT_TRUE(x0.is_reg());
EXPECT_EQ(w0.id(), 0u);
EXPECT_EQ(x0.id(), 0u);
EXPECT_EQ(wzr.id(), Gp::kIdZr);
EXPECT_EQ(xzr.id(), Gp::kIdZr);
EXPECT_EQ(wsp.id(), Gp::kIdSp);
EXPECT_EQ(sp.id(), Gp::kIdSp);
EXPECT_EQ(w0.size(), 4u);
EXPECT_EQ(x0.size(), 8u);
EXPECT_EQ(w0.reg_type(), RegType::kGp32);
EXPECT_EQ(x0.reg_type(), RegType::kGp64);
EXPECT_EQ(w0.reg_group(), RegGroup::kGp);
EXPECT_EQ(x0.reg_group(), RegGroup::kGp);
INFO("Checking Vec register properties");
EXPECT_EQ(v0.reg_type(), RegType::kVec128);
EXPECT_EQ(d0.reg_type(), RegType::kVec64);
EXPECT_EQ(s0.reg_type(), RegType::kVec32);
EXPECT_EQ(h0.reg_type(), RegType::kVec16);
EXPECT_EQ(b0.reg_type(), RegType::kVec8);
EXPECT_EQ(v0.reg_group(), RegGroup::kVec);
EXPECT_EQ(d0.reg_group(), RegGroup::kVec);
EXPECT_EQ(s0.reg_group(), RegGroup::kVec);
EXPECT_EQ(h0.reg_group(), RegGroup::kVec);
EXPECT_EQ(b0.reg_group(), RegGroup::kVec);
INFO("Checking Vec register element[] access");
Vec vd_1 = v15.d(1);
EXPECT_EQ(vd_1.reg_type(), RegType::kVec128);
EXPECT_EQ(vd_1.reg_group(), RegGroup::kVec);
EXPECT_EQ(vd_1.id(), 15u);
EXPECT_TRUE(vd_1.is_vec_d2());
EXPECT_EQ(vd_1.element_type(), VecElementType::kD);
EXPECT_TRUE(vd_1.has_element_index());
EXPECT_EQ(vd_1.element_index(), 1u);
Vec vs_3 = v15.s(3);
EXPECT_EQ(vs_3.reg_type(), RegType::kVec128);
EXPECT_EQ(vs_3.reg_group(), RegGroup::kVec);
EXPECT_EQ(vs_3.id(), 15u);
EXPECT_TRUE(vs_3.is_vec_s4());
EXPECT_EQ(vs_3.element_type(), VecElementType::kS);
EXPECT_TRUE(vs_3.has_element_index());
EXPECT_EQ(vs_3.element_index(), 3u);
Vec vb_4 = v15.b4(3);
EXPECT_EQ(vb_4.reg_type(), RegType::kVec128);
EXPECT_EQ(vb_4.reg_group(), RegGroup::kVec);
EXPECT_EQ(vb_4.id(), 15u);
EXPECT_TRUE(vb_4.is_vec_b4x4());
EXPECT_EQ(vb_4.element_type(), VecElementType::kB4);
EXPECT_TRUE(vb_4.has_element_index());
EXPECT_EQ(vb_4.element_index(), 3u);
}
#endif
ASMJIT_END_SUB_NAMESPACE
#endif // !ASMJIT_NO_AARCH64