[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:
@@ -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>(
|
||||
|
||||
Reference in New Issue
Block a user