Arm64Emitter: Add additional assertions to BFI/UBFIZ

This commit is contained in:
MerryMage 2021-01-31 11:50:34 +00:00
parent 75d92ad628
commit 8aa2013a2d
1 changed files with 2 additions and 2 deletions

View File

@ -1658,7 +1658,7 @@ void ARM64XEmitter::UBFM(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms)
void ARM64XEmitter::BFI(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width)
{
u32 size = Is64Bit(Rn) ? 64 : 32;
ASSERT_MSG(DYNA_REC, (lsb + width) <= size,
ASSERT_MSG(DYNA_REC, lsb < size && width >= 1 && width <= size - lsb,
"%s passed lsb %d and width %d which is greater than the register size!", __func__,
lsb, width);
BFM(Rd, Rn, (size - lsb) % size, width - 1);
@ -1674,7 +1674,7 @@ void ARM64XEmitter::BFXIL(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width)
void ARM64XEmitter::UBFIZ(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width)
{
u32 size = Is64Bit(Rn) ? 64 : 32;
ASSERT_MSG(DYNA_REC, (lsb + width) <= size,
ASSERT_MSG(DYNA_REC, lsb < size && width >= 1 && width <= size - lsb,
"%s passed lsb %d and width %d which is greater than the register size!", __func__,
lsb, width);
UBFM(Rd, Rn, (size - lsb) % size, width - 1);