ppc: cleanup cmpw/cmpwi as CmpS32

Change-Id: I7afc5bede8684f469670c84da0f94d251369e6fb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3011165
Reviewed-by: Milad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#75611}
This commit is contained in:
Junliang Yan 2021-07-07 09:46:22 -04:00 committed by V8 LUCI CQ
parent bd6880bc01
commit 7a17502808
3 changed files with 18 additions and 13 deletions

View File

@ -1930,7 +1930,7 @@ void MacroAssembler::JumpToInstructionStream(Address entry) {
void MacroAssembler::LoadWeakValue(Register out, Register in,
Label* target_if_cleared) {
cmpwi(in, Operand(kClearedWeakHeapObjectLower32));
CmpS32(in, Operand(kClearedWeakHeapObjectLower32), r0);
beq(target_if_cleared);
mov(r0, Operand(~kWeakHeapObjectMask));
@ -2640,17 +2640,21 @@ void TurboAssembler::CmpU64(Register src1, Register src2, CRegister cr) {
cmpl(src1, src2, cr);
}
void TurboAssembler::Cmpwi(Register src1, const Operand& src2, Register scratch,
CRegister cr) {
void TurboAssembler::CmpS32(Register src1, const Operand& src2,
Register scratch, CRegister cr) {
intptr_t value = src2.immediate();
if (is_int16(value)) {
cmpwi(src1, src2, cr);
} else {
mov(scratch, src2);
cmpw(src1, scratch, cr);
CmpS32(src1, scratch, cr);
}
}
void TurboAssembler::CmpS32(Register src1, Register src2, CRegister cr) {
cmpw(src1, src2, cr);
}
void MacroAssembler::Cmplwi(Register src1, const Operand& src2,
Register scratch, CRegister cr) {
intptr_t value = src2.immediate();
@ -2715,7 +2719,7 @@ void MacroAssembler::Xor(Register ra, Register rs, const Operand& rb,
void MacroAssembler::CmpSmiLiteral(Register src1, Smi smi, Register scratch,
CRegister cr) {
#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
Cmpwi(src1, Operand(smi), scratch, cr);
CmpS32(src1, Operand(smi), scratch, cr);
#else
LoadSmiLiteral(scratch, smi);
CmpS64(src1, scratch, cr);

View File

@ -158,11 +158,12 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void CmpU64(Register src1, const Operand& src2, Register scratch,
CRegister cr = cr7);
void CmpU64(Register src1, Register src2, CRegister cr = cr7);
void Cmpwi(Register src1, const Operand& src2, Register scratch,
CRegister cr = cr7);
void CmpS32(Register src1, const Operand& src2, Register scratch,
CRegister cr = cr7);
void CmpS32(Register src1, Register src2, CRegister cr = cr7);
void CompareTagged(Register src1, Register src2, CRegister cr = cr7) {
if (COMPRESS_POINTERS_BOOL) {
cmpw(src1, src2, cr);
CmpS32(src1, src2, cr);
} else {
CmpS64(src1, src2, cr);
}

View File

@ -1011,7 +1011,7 @@ void LiftoffAssembler::emit_cond_jump(LiftoffCondition liftoff_cond,
switch (kind) {
case kI32:
if (use_signed) {
cmpw(lhs, rhs);
CmpS32(lhs, rhs);
} else {
cmplw(lhs, rhs);
}
@ -1035,7 +1035,7 @@ void LiftoffAssembler::emit_cond_jump(LiftoffCondition liftoff_cond,
} else {
DCHECK_EQ(kind, kI32);
CHECK(use_signed);
cmpwi(lhs, Operand::Zero());
CmpS32(lhs, Operand::Zero(), r0);
}
b(cond, label);
@ -1045,13 +1045,13 @@ void LiftoffAssembler::emit_i32_cond_jumpi(LiftoffCondition liftoff_cond,
Label* label, Register lhs,
int32_t imm) {
Condition cond = liftoff::ToCondition(liftoff_cond);
Cmpwi(lhs, Operand(imm), r0);
CmpS32(lhs, Operand(imm), r0);
b(cond, label);
}
void LiftoffAssembler::emit_i32_eqz(Register dst, Register src) {
Label done;
cmpwi(src, Operand(0));
CmpS32(src, Operand(0), r0);
mov(dst, Operand(1));
beq(&done);
mov(dst, Operand::Zero());
@ -1063,7 +1063,7 @@ void LiftoffAssembler::emit_i32_set_cond(LiftoffCondition liftoff_cond,
Register rhs) {
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (use_signed) {
cmpw(lhs, rhs);
CmpS32(lhs, rhs);
} else {
cmplw(lhs, rhs);
}