Skip to content

Commit 9888fcf

Browse files
committed
[bug] Fixed a bug in Vec::half() that halved to ZMM instead of XMM
1 parent b56f417 commit 9888fcf

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

asmjit/x86/x86operand.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ UNIT(x86_operand) {
141141
EXPECT_EQ(zmm7.ymm(), ymm7);
142142
EXPECT_EQ(zmm7.zmm(), zmm7);
143143

144+
EXPECT_EQ(xmm4.half(), xmm4);
145+
EXPECT_EQ(ymm4.half(), xmm4);
146+
EXPECT_EQ(zmm4.half(), ymm4);
147+
144148
INFO("Checking x86::Mm register properties");
145149
EXPECT_TRUE(Mm().is_reg());
146150
EXPECT_TRUE(mm2.is_reg());

asmjit/x86/x86operand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class Vec : public UniVec {
237237
//! was ZMM, or XMM for whatever else input.
238238
[[nodiscard]]
239239
ASMJIT_INLINE_CONSTEXPR Vec half() const noexcept {
240-
return Vec(is_vec512() ? signature_of_t<RegType::kVec256>() : signature_of_t<RegType::kVec512>(), id());
240+
return Vec(is_vec512() ? signature_of_t<RegType::kVec256>() : signature_of_t<RegType::kVec128>(), id());
241241
}
242242

243243
//! \}

0 commit comments

Comments
 (0)