[CPU] Correctly zero extend instead of sign extending

When performing unsigned multiplication on Linux/GCC,
the code incorrectly cast constant.i64 (which is a signed int64_t)
to unsigned __int128. This caused sign extension when
the value should be treated as unsigned.
This commit is contained in:
Herman S.
2025-10-18 11:33:02 +09:00
parent 7912eab85e
commit 643c13668d

View File

@@ -413,8 +413,10 @@ void Value::MulHi(Value* other, bool is_unsigned) {
#else
if (is_unsigned) {
constant.i64 = static_cast<uint64_t>(
(static_cast<unsigned __int128>(constant.i64) *
static_cast<unsigned __int128>(other->constant.i64)) >>
(static_cast<unsigned __int128>(
static_cast<uint64_t>(constant.i64)) *
static_cast<unsigned __int128>(
static_cast<uint64_t>(other->constant.i64))) >>
64);
} else {
constant.i64 = static_cast<uint64_t>(