PPC/S390[baseline]: Separate signed and unsigned conditions
ppc/s390 use separate instructions for signed/unsigned comparisons in order to set flags. We need to be able to differentiate between these two types in order to emit the correct instruction. Change-Id: Ia1b4508994c6e21a7d86ab070234eb37f76aca29 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4198317 Reviewed-by: Junliang Yan <junyan@redhat.com> Commit-Queue: Milad Farazmand <mfarazma@redhat.com> Cr-Commit-Position: refs/heads/main@{#85527}
This commit is contained in:
parent
74085b2af4
commit
de36f16642
@ -94,7 +94,7 @@ static void JumpIfHelper(MacroAssembler* assm, Condition cc, Register lhs,
|
||||
__ CmpU32(lhs, rhs);
|
||||
}
|
||||
}
|
||||
__ b(cc, target);
|
||||
__ b(check_condition(cc), target);
|
||||
}
|
||||
#undef __
|
||||
|
||||
@ -160,7 +160,7 @@ void BaselineAssembler::TestAndBranch(Register value, int mask, Condition cc,
|
||||
Label* target, Label::Distance) {
|
||||
ASM_CODE_COMMENT(masm_);
|
||||
__ AndU64(r0, value, Operand(mask), ip, SetRC);
|
||||
__ b(cc, target, cr0);
|
||||
__ b(check_condition(cc), target, cr0);
|
||||
}
|
||||
|
||||
void BaselineAssembler::JumpIf(Condition cc, Register lhs, const Operand& rhs,
|
||||
@ -171,7 +171,7 @@ void BaselineAssembler::JumpIf(Condition cc, Register lhs, const Operand& rhs,
|
||||
} else {
|
||||
__ CmpU64(lhs, rhs, r0);
|
||||
}
|
||||
__ b(cc, target);
|
||||
__ b(check_condition(cc), target);
|
||||
}
|
||||
|
||||
void BaselineAssembler::JumpIfObjectType(Condition cc, Register object,
|
||||
|
@ -93,7 +93,7 @@ static void JumpIfHelper(MacroAssembler* assm, Condition cc, Register lhs,
|
||||
__ CmpU32(lhs, rhs);
|
||||
}
|
||||
}
|
||||
__ b(cc, target);
|
||||
__ b(check_condition(cc), target);
|
||||
}
|
||||
|
||||
#undef __
|
||||
@ -159,7 +159,7 @@ void BaselineAssembler::TestAndBranch(Register value, int mask, Condition cc,
|
||||
Label* target, Label::Distance) {
|
||||
ASM_CODE_COMMENT(masm_);
|
||||
__ AndP(r0, value, Operand(mask));
|
||||
__ b(cc, target);
|
||||
__ b(check_condition(cc), target);
|
||||
}
|
||||
|
||||
void BaselineAssembler::JumpIf(Condition cc, Register lhs, const Operand& rhs,
|
||||
@ -170,7 +170,7 @@ void BaselineAssembler::JumpIf(Condition cc, Register lhs, const Operand& rhs,
|
||||
} else {
|
||||
__ CmpU64(lhs, rhs);
|
||||
}
|
||||
__ b(cc, target);
|
||||
__ b(check_condition(cc), target);
|
||||
}
|
||||
|
||||
void BaselineAssembler::JumpIfObjectType(Condition cc, Register object,
|
||||
|
@ -132,22 +132,45 @@ enum Condition {
|
||||
al = 10, // Always.
|
||||
|
||||
// Unified cross-platform condition names/aliases.
|
||||
// Do not set unsigned constants equal to their signed variants.
|
||||
// We need to be able to differentiate between signed and unsigned enum
|
||||
// constants in order to emit the right instructions (i.e CmpS64 vs CmpU64).
|
||||
kEqual = eq,
|
||||
kNotEqual = ne,
|
||||
kLessThan = lt,
|
||||
kGreaterThan = gt,
|
||||
kLessThanEqual = le,
|
||||
kGreaterThanEqual = ge,
|
||||
kUnsignedLessThan = lt,
|
||||
kUnsignedGreaterThan = gt,
|
||||
kUnsignedLessThanEqual = le,
|
||||
kUnsignedGreaterThanEqual = ge,
|
||||
kUnsignedLessThan = 11,
|
||||
kUnsignedGreaterThan = 12,
|
||||
kUnsignedLessThanEqual = 13,
|
||||
kUnsignedGreaterThanEqual = 14,
|
||||
kOverflow = overflow,
|
||||
kNoOverflow = nooverflow,
|
||||
kZero = eq,
|
||||
kNotZero = ne,
|
||||
kZero = 15,
|
||||
kNotZero = 16,
|
||||
};
|
||||
|
||||
inline Condition check_condition(Condition cond) {
|
||||
switch (cond) {
|
||||
case kUnsignedLessThan:
|
||||
return lt;
|
||||
case kUnsignedGreaterThan:
|
||||
return gt;
|
||||
case kUnsignedLessThanEqual:
|
||||
return le;
|
||||
case kUnsignedGreaterThanEqual:
|
||||
return ge;
|
||||
case kZero:
|
||||
return eq;
|
||||
case kNotZero:
|
||||
return ne;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cond;
|
||||
}
|
||||
|
||||
inline Condition NegateCondition(Condition cond) {
|
||||
DCHECK(cond != al);
|
||||
return static_cast<Condition>(cond ^ ne);
|
||||
|
@ -104,22 +104,45 @@ enum Condition {
|
||||
mask0xF = 15,
|
||||
|
||||
// Unified cross-platform condition names/aliases.
|
||||
// Do not set unsigned constants equal to their signed variants.
|
||||
// We need to be able to differentiate between signed and unsigned enum
|
||||
// constants in order to emit the right instructions (i.e CmpS64 vs CmpU64).
|
||||
kEqual = eq,
|
||||
kNotEqual = ne,
|
||||
kLessThan = lt,
|
||||
kGreaterThan = gt,
|
||||
kLessThanEqual = le,
|
||||
kGreaterThanEqual = ge,
|
||||
kUnsignedLessThan = lt,
|
||||
kUnsignedGreaterThan = gt,
|
||||
kUnsignedLessThanEqual = le,
|
||||
kUnsignedGreaterThanEqual = ge,
|
||||
kUnsignedLessThan = 16,
|
||||
kUnsignedGreaterThan = 17,
|
||||
kUnsignedLessThanEqual = 18,
|
||||
kUnsignedGreaterThanEqual = 19,
|
||||
kOverflow = overflow,
|
||||
kNoOverflow = nooverflow,
|
||||
kZero = eq,
|
||||
kNotZero = ne,
|
||||
kZero = 20,
|
||||
kNotZero = 21,
|
||||
};
|
||||
|
||||
inline Condition check_condition(Condition cond) {
|
||||
switch (cond) {
|
||||
case kUnsignedLessThan:
|
||||
return lt;
|
||||
case kUnsignedGreaterThan:
|
||||
return gt;
|
||||
case kUnsignedLessThanEqual:
|
||||
return le;
|
||||
case kUnsignedGreaterThanEqual:
|
||||
return ge;
|
||||
case kZero:
|
||||
return eq;
|
||||
case kNotZero:
|
||||
return ne;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cond;
|
||||
}
|
||||
|
||||
inline Condition NegateCondition(Condition cond) {
|
||||
DCHECK(cond != al);
|
||||
switch (cond) {
|
||||
|
Loading…
Reference in New Issue
Block a user