From 9888fcf2133f253b890c9fbd586dbafa0a273044 Mon Sep 17 00:00:00 2001 From: kobalicek Date: Thu, 13 Nov 2025 21:50:54 +0100 Subject: [PATCH] [bug] Fixed a bug in Vec::half() that halved to ZMM instead of XMM --- asmjit/x86/x86operand.cpp | 4 ++++ asmjit/x86/x86operand.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/asmjit/x86/x86operand.cpp b/asmjit/x86/x86operand.cpp index 8477dcf..9a29406 100644 --- a/asmjit/x86/x86operand.cpp +++ b/asmjit/x86/x86operand.cpp @@ -141,6 +141,10 @@ UNIT(x86_operand) { EXPECT_EQ(zmm7.ymm(), ymm7); EXPECT_EQ(zmm7.zmm(), zmm7); + EXPECT_EQ(xmm4.half(), xmm4); + EXPECT_EQ(ymm4.half(), xmm4); + EXPECT_EQ(zmm4.half(), ymm4); + INFO("Checking x86::Mm register properties"); EXPECT_TRUE(Mm().is_reg()); EXPECT_TRUE(mm2.is_reg()); diff --git a/asmjit/x86/x86operand.h b/asmjit/x86/x86operand.h index 2f5357f..8725d8b 100644 --- a/asmjit/x86/x86operand.h +++ b/asmjit/x86/x86operand.h @@ -237,7 +237,7 @@ class Vec : public UniVec { //! was ZMM, or XMM for whatever else input. [[nodiscard]] ASMJIT_INLINE_CONSTEXPR Vec half() const noexcept { - return Vec(is_vec512() ? signature_of_t() : signature_of_t(), id()); + return Vec(is_vec512() ? signature_of_t() : signature_of_t(), id()); } //! \}