From 533515426674dd8f7d029fd5bb88870830038164 Mon Sep 17 00:00:00 2001 From: William Chen Date: Mon, 25 Jul 2022 12:08:40 -0700 Subject: [PATCH] fix signed div/mod with unsigned const. --- src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp index 1363204d98..9d845cdf80 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_cgfunc.cpp @@ -893,8 +893,10 @@ MemOperand &AArch64CGFunc::ConstraintOffsetToSafeRegion(uint32 bitLen, const Mem hashMemOpndTable.erase(memOpnd); } int32 offsetValue = static_cast(memOpnd.GetOffsetImmediate()->GetOffsetValue()); - int32 multiplier = (offsetValue / k512BitSizeInt) + static_cast(offsetValue % k512BitSizeInt > k256BitSizeInt); - int32 addMount = multiplier * k512BitSizeInt; + int32 val256 = k256BitSizeInt; /* const val is unsigned */ + int32 val512 = k512BitSizeInt; + int32 multiplier = (offsetValue / val512) + static_cast(offsetValue % val512 > val256); + int32 addMount = multiplier * val512; int32 newOffset = offsetValue - addMount; RegOperand *baseReg = memOpnd.GetBaseRegister(); ImmOperand &immAddMount = CreateImmOperand(addMount, k64BitSize, true); -- Gitee