Commit 20703d7f authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

s390x: rename Cmp operations

Change-Id: Idb8948c3ff9209a6a41d0793cd2f5c1557b417df
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2598697Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71851}
parent 94bf7d9f
This diff is collapsed.
......@@ -549,7 +549,7 @@ void TurboAssembler::PushArray(Register array, Register size, Register scratch,
ShiftLeftU64(scratch, size, Operand(kSystemPointerSizeLog2));
lay(scratch, MemOperand(array, scratch));
bind(&loop);
CmpP(array, scratch);
CmpS64(array, scratch);
bge(&done);
lay(scratch, MemOperand(scratch, -kSystemPointerSize));
lay(sp, MemOperand(sp, -kSystemPointerSize));
......@@ -562,7 +562,7 @@ void TurboAssembler::PushArray(Register array, Register size, Register scratch,
lay(scratch, MemOperand(array, scratch));
mov(scratch2, array);
bind(&loop);
CmpP(scratch2, scratch);
CmpS64(scratch2, scratch);
bge(&done);
lay(sp, MemOperand(sp, -kSystemPointerSize));
MoveChar(MemOperand(sp), MemOperand(scratch2), Operand(kSystemPointerSize));
......@@ -885,7 +885,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
DCHECK(object != value);
if (emit_debug_code()) {
LoadTaggedPointerField(r0, MemOperand(address));
CmpP(value, r0);
CmpS64(value, r0);
Check(eq, AbortReason::kWrongAddressOrValuePassedToRecordWrite);
}
......@@ -1449,7 +1449,7 @@ void TurboAssembler::PrepareForTailCall(Register callee_args_count,
AddS64(src_reg, src_reg, Operand(kSystemPointerSize));
if (FLAG_debug_code) {
CmpLogicalP(src_reg, dst_reg);
CmpU64(src_reg, dst_reg);
Check(lt, AbortReason::kStackAccessBelowStackPointer);
}
......@@ -1503,7 +1503,7 @@ void MacroAssembler::StackOverflowCheck(Register num_args, Register scratch,
SubS64(scratch, sp, scratch);
// Check if the arguments will overflow the stack.
ShiftLeftU64(r0, num_args, Operand(kSystemPointerSizeLog2));
CmpP(scratch, r0);
CmpS64(scratch, r0);
ble(stack_overflow); // Signed comparison.
}
......@@ -1522,7 +1522,7 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
#ifdef V8_NO_ARGUMENTS_ADAPTOR
// If the expected parameter count is equal to the adaptor sentinel, no need
// to push undefined value as arguments.
CmpP(expected_parameter_count, Operand(kDontAdaptArgumentsSentinel));
CmpS64(expected_parameter_count, Operand(kDontAdaptArgumentsSentinel));
beq(&regular_invoke);
// If overapplication or if the actual argument count is equal to the
......@@ -1579,7 +1579,7 @@ void MacroAssembler::InvokePrologue(Register expected_parameter_count,
#else
// Check whether the expected and actual arguments count match. If not,
// setup registers according to contract with ArgumentsAdaptorTrampoline.
CmpP(expected_parameter_count, actual_parameter_count);
CmpS64(expected_parameter_count, actual_parameter_count);
beq(&regular_invoke);
Handle<Code> adaptor = BUILTIN_CODE(isolate(), ArgumentsAdaptorTrampoline);
......@@ -1719,7 +1719,7 @@ void MacroAssembler::MaybeDropFrames() {
ExternalReference::debug_restart_fp_address(isolate());
Move(r3, restart_fp);
LoadP(r3, MemOperand(r3));
CmpP(r3, Operand::Zero());
CmpS64(r3, Operand::Zero());
Jump(BUILTIN_CODE(isolate(), FrameDropperTrampoline), RelocInfo::CODE_TARGET,
ne);
}
......@@ -1773,7 +1773,7 @@ void MacroAssembler::CompareInstanceType(Register map, Register type_reg,
STATIC_ASSERT(Map::kInstanceTypeOffset < 4096);
STATIC_ASSERT(LAST_TYPE <= 0xFFFF);
LoadS16(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
CmpP(type_reg, Operand(type));
CmpS64(type_reg, Operand(type));
}
void MacroAssembler::CompareRoot(Register obj, RootIndex index) {
......@@ -1791,9 +1791,9 @@ void MacroAssembler::JumpIfIsInRange(Register value, unsigned lower_limit,
Register scratch = r0;
mov(scratch, value);
slgfi(scratch, Operand(lower_limit));
CmpLogicalP(scratch, Operand(higher_limit - lower_limit));
CmpU64(scratch, Operand(higher_limit - lower_limit));
} else {
CmpLogicalP(value, Operand(higher_limit));
CmpU64(value, Operand(higher_limit));
}
ble(on_in_range);
}
......@@ -1884,7 +1884,7 @@ void MacroAssembler::JumpToInstructionStream(Address entry) {
void MacroAssembler::LoadWeakValue(Register out, Register in,
Label* target_if_cleared) {
Cmp32(in, Operand(kClearedWeakHeapObjectLower32));
CmpS32(in, Operand(kClearedWeakHeapObjectLower32));
beq(target_if_cleared);
AndP(out, in, Operand(~kWeakHeapObjectMask));
......@@ -2053,11 +2053,11 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
beq(&do_check);
// Check if JSAsyncFunctionObject (See MacroAssembler::CompareInstanceType)
CmpP(instance_type, Operand(JS_ASYNC_FUNCTION_OBJECT_TYPE));
CmpS64(instance_type, Operand(JS_ASYNC_FUNCTION_OBJECT_TYPE));
beq(&do_check);
// Check if JSAsyncGeneratorObject (See MacroAssembler::CompareInstanceType)
CmpP(instance_type, Operand(JS_ASYNC_GENERATOR_OBJECT_TYPE));
CmpS64(instance_type, Operand(JS_ASYNC_GENERATOR_OBJECT_TYPE));
bind(&do_check);
// Restore generator object to register and perform assertion
......@@ -3253,20 +3253,14 @@ void TurboAssembler::LoadPositive32(Register result, Register input) {
//-----------------------------------------------------------------------------
// Compare 32-bit Register vs Register
void TurboAssembler::Cmp32(Register src1, Register src2) { cr_z(src1, src2); }
void TurboAssembler::CmpS32(Register src1, Register src2) { cr_z(src1, src2); }
// Compare Pointer Sized Register vs Register
void TurboAssembler::CmpP(Register src1, Register src2) {
#if V8_TARGET_ARCH_S390X
cgr(src1, src2);
#else
Cmp32(src1, src2);
#endif
}
void TurboAssembler::CmpS64(Register src1, Register src2) { cgr(src1, src2); }
// Compare 32-bit Register vs Immediate
// This helper will set up proper relocation entries if required.
void TurboAssembler::Cmp32(Register dst, const Operand& opnd) {
void TurboAssembler::CmpS32(Register dst, const Operand& opnd) {
if (opnd.rmode() == RelocInfo::NONE) {
intptr_t value = opnd.immediate();
if (is_int16(value))
......@@ -3282,21 +3276,17 @@ void TurboAssembler::Cmp32(Register dst, const Operand& opnd) {
// Compare Pointer Sized Register vs Immediate
// This helper will set up proper relocation entries if required.
void TurboAssembler::CmpP(Register dst, const Operand& opnd) {
#if V8_TARGET_ARCH_S390X
void TurboAssembler::CmpS64(Register dst, const Operand& opnd) {
if (opnd.rmode() == RelocInfo::NONE) {
cgfi(dst, opnd);
} else {
mov(r0, opnd); // Need to generate 64-bit relocation
cgr(dst, r0);
}
#else
Cmp32(dst, opnd);
#endif
}
// Compare 32-bit Register vs Memory
void TurboAssembler::Cmp32(Register dst, const MemOperand& opnd) {
void TurboAssembler::CmpS32(Register dst, const MemOperand& opnd) {
// make sure offset is within 20 bit range
DCHECK(is_int20(opnd.offset()));
if (is_uint12(opnd.offset()))
......@@ -3306,14 +3296,10 @@ void TurboAssembler::Cmp32(Register dst, const MemOperand& opnd) {
}
// Compare Pointer Size Register vs Memory
void TurboAssembler::CmpP(Register dst, const MemOperand& opnd) {
void TurboAssembler::CmpS64(Register dst, const MemOperand& opnd) {
// make sure offset is within 20 bit range
DCHECK(is_int20(opnd.offset()));
#if V8_TARGET_ARCH_S390X
cg(dst, opnd);
#else
Cmp32(dst, opnd);
#endif
}
// Using cs or scy based on the offset
......@@ -3337,34 +3323,34 @@ void TurboAssembler::CmpAndSwap64(Register old_val, Register new_val,
//-----------------------------------------------------------------------------
// Compare Logical 32-bit Register vs Register
void TurboAssembler::CmpLogical32(Register dst, Register src) { clr(dst, src); }
void TurboAssembler::CmpU32(Register dst, Register src) { clr(dst, src); }
// Compare Logical Pointer Sized Register vs Register
void TurboAssembler::CmpLogicalP(Register dst, Register src) {
void TurboAssembler::CmpU64(Register dst, Register src) {
#ifdef V8_TARGET_ARCH_S390X
clgr(dst, src);
#else
CmpLogical32(dst, src);
CmpU32(dst, src);
#endif
}
// Compare Logical 32-bit Register vs Immediate
void TurboAssembler::CmpLogical32(Register dst, const Operand& opnd) {
void TurboAssembler::CmpU32(Register dst, const Operand& opnd) {
clfi(dst, opnd);
}
// Compare Logical Pointer Sized Register vs Immediate
void TurboAssembler::CmpLogicalP(Register dst, const Operand& opnd) {
void TurboAssembler::CmpU64(Register dst, const Operand& opnd) {
#if V8_TARGET_ARCH_S390X
DCHECK_EQ(static_cast<uint32_t>(opnd.immediate() >> 32), 0);
clgfi(dst, opnd);
#else
CmpLogical32(dst, opnd);
CmpU32(dst, opnd);
#endif
}
// Compare Logical 32-bit Register vs Memory
void TurboAssembler::CmpLogical32(Register dst, const MemOperand& opnd) {
void TurboAssembler::CmpU32(Register dst, const MemOperand& opnd) {
// make sure offset is within 20 bit range
DCHECK(is_int20(opnd.offset()));
if (is_uint12(opnd.offset()))
......@@ -3374,25 +3360,16 @@ void TurboAssembler::CmpLogical32(Register dst, const MemOperand& opnd) {
}
// Compare Logical Pointer Sized Register vs Memory
void TurboAssembler::CmpLogicalP(Register dst, const MemOperand& opnd) {
void TurboAssembler::CmpU64(Register dst, const MemOperand& opnd) {
// make sure offset is within 20 bit range
DCHECK(is_int20(opnd.offset()));
#if V8_TARGET_ARCH_S390X
clg(dst, opnd);
#else
CmpLogical32(dst, opnd);
CmpU32(dst, opnd);
#endif
}
// Compare Logical Byte (Mem - Imm)
void TurboAssembler::CmpLogicalByte(const MemOperand& mem, const Operand& imm) {
DCHECK(is_uint8(imm.immediate()));
if (is_uint12(mem.offset()))
cli(mem, imm);
else
cliy(mem, imm);
}
void TurboAssembler::Branch(Condition c, const Operand& opnd) {
intptr_t value = opnd.immediate();
if (is_int16(value))
......@@ -4290,12 +4267,12 @@ void TurboAssembler::LoadPC(Register dst) {
}
void TurboAssembler::JumpIfEqual(Register x, int32_t y, Label* dest) {
Cmp32(x, Operand(y));
CmpS32(x, Operand(y));
beq(dest);
}
void TurboAssembler::JumpIfLessThan(Register x, int32_t y, Label* dest) {
Cmp32(x, Operand(y));
CmpS32(x, Operand(y));
blt(dest);
}
......
......@@ -304,25 +304,27 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Sqrt(DoubleRegister result, const MemOperand& input);
// Compare
void Cmp32(Register src1, Register src2);
void CmpP(Register src1, Register src2);
void Cmp32(Register dst, const Operand& opnd);
void CmpP(Register dst, const Operand& opnd);
void Cmp32(Register dst, const MemOperand& opnd);
void CmpP(Register dst, const MemOperand& opnd);
void CmpS32(Register src1, Register src2);
void CmpS64(Register src1, Register src2);
void CmpS32(Register dst, const Operand& opnd);
void CmpS64(Register dst, const Operand& opnd);
void CmpS32(Register dst, const MemOperand& opnd);
void CmpS64(Register dst, const MemOperand& opnd);
void CmpAndSwap(Register old_val, Register new_val, const MemOperand& opnd);
void CmpAndSwap64(Register old_val, Register new_val, const MemOperand& opnd);
// TODO(john.yan): remove this
template <class T>
void CmpP(Register src1, T src2) {
CmpS64(src1, src2);
}
// Compare Logical
void CmpLogical32(Register src1, Register src2);
void CmpLogicalP(Register src1, Register src2);
void CmpLogical32(Register src1, const Operand& opnd);
void CmpLogicalP(Register src1, const Operand& opnd);
void CmpLogical32(Register dst, const MemOperand& opnd);
void CmpLogicalP(Register dst, const MemOperand& opnd);
// Compare Logical Byte (CLI/CLIY)
void CmpLogicalByte(const MemOperand& mem, const Operand& imm);
void CmpU32(Register src1, Register src2);
void CmpU64(Register src1, Register src2);
void CmpU32(Register src1, const Operand& opnd);
void CmpU64(Register src1, const Operand& opnd);
void CmpU32(Register dst, const MemOperand& opnd);
void CmpU64(Register dst, const MemOperand& opnd);
// Load 32bit
void LoadS32(Register dst, const MemOperand& opnd, Register scratch = no_reg);
......@@ -1080,9 +1082,9 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
template <class T>
void CompareTagged(Register src1, T src2) {
if (COMPRESS_POINTERS_BOOL) {
Cmp32(src1, src2);
CmpS32(src1, src2);
} else {
CmpP(src1, src2);
CmpS64(src1, src2);
}
}
......
......@@ -1013,8 +1013,8 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg,
// Check if current frame is an arguments adaptor frame.
__ LoadP(scratch1, MemOperand(fp, StandardFrameConstants::kContextOffset));
__ CmpP(scratch1,
Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)));
__ CmpS64(scratch1,
Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)));
__ bne(&done);
// Load arguments count from current arguments adaptor frame (note, it
......@@ -1133,7 +1133,7 @@ void CodeGenerator::AssembleTailCallAfterGap(Instruction* instr,
void CodeGenerator::AssembleCodeStartRegisterCheck() {
Register scratch = r1;
__ ComputeCodeStartAddress(scratch);
__ CmpP(scratch, kJavaScriptCallCodeStartRegister);
__ CmpS64(scratch, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......@@ -1148,7 +1148,7 @@ void CodeGenerator::BailoutIfDeoptimized() {
if (FLAG_debug_code) {
// Check that {kJavaScriptCallCodeStartRegister} is correct.
__ ComputeCodeStartAddress(ip);
__ CmpP(ip, kJavaScriptCallCodeStartRegister);
__ CmpS64(ip, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......@@ -1171,7 +1171,7 @@ void CodeGenerator::GenerateSpeculationPoisonFromCodeStartRegister() {
// bits cleared if we are speculatively executing the wrong PC.
__ mov(kSpeculationPoisonRegister, Operand::Zero());
__ mov(r0, Operand(-1));
__ CmpP(kJavaScriptCallCodeStartRegister, scratch);
__ CmpS64(kJavaScriptCallCodeStartRegister, scratch);
__ LoadOnConditionP(eq, kSpeculationPoisonRegister, r0);
}
......@@ -1293,7 +1293,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
// Check the function's context matches the context argument.
__ LoadTaggedPointerField(
kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset));
__ CmpP(cp, kScratchReg);
__ CmpS64(cp, kScratchReg);
__ Assert(eq, AbortReason::kWrongFunctionContext);
}
static_assert(kJavaScriptCallCodeStartRegister == r4, "ABI mismatch");
......@@ -1441,7 +1441,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
constexpr size_t kValueIndex = 0;
DCHECK(instr->InputAt(kValueIndex)->IsRegister());
__ CmpLogicalP(lhs_register, i.InputRegister(kValueIndex));
__ CmpU64(lhs_register, i.InputRegister(kValueIndex));
break;
}
case kArchStackCheckOffset:
......@@ -1944,11 +1944,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
#endif
case kS390_Cmp32:
ASSEMBLE_COMPARE32(Cmp32, CmpLogical32);
ASSEMBLE_COMPARE32(CmpS32, CmpU32);
break;
#if V8_TARGET_ARCH_S390X
case kS390_Cmp64:
ASSEMBLE_COMPARE(CmpP, CmpLogicalP);
ASSEMBLE_COMPARE(CmpS64, CmpU64);
break;
#endif
case kS390_CmpFloat:
......@@ -4380,7 +4380,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
cases[index] = GetLabel(i.InputRpo(index + 2));
}
Label* const table = AddJumpTable(cases, case_count);
__ CmpLogicalP(input, Operand(case_count));
__ CmpU64(input, Operand(case_count));
__ bge(GetLabel(i.InputRpo(1)));
__ larl(kScratchReg, table);
__ ShiftLeftU64(r1, input, Operand(kSystemPointerSizeLog2));
......@@ -4493,7 +4493,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ LoadP(scratch, MemOperand(scratch));
__ AddS64(scratch, scratch,
Operand(required_slots * kSystemPointerSize));
__ CmpLogicalP(sp, scratch);
__ CmpU64(sp, scratch);
__ bge(&done);
}
......@@ -4570,7 +4570,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
__ CmpP(g.ToRegister(additional_pop_count), Operand(0));
__ CmpS64(g.ToRegister(additional_pop_count), Operand(0));
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue);
}
}
......@@ -4614,7 +4614,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
__ AddS64(argc_reg, argc_reg, Operand(1)); // Also pop the receiver.
if (parameter_count > 1) {
Label skip;
__ CmpP(argc_reg, Operand(parameter_count));
__ CmpS64(argc_reg, Operand(parameter_count));
__ bgt(&skip);
__ mov(argc_reg, Operand(parameter_count));
__ bind(&skip);
......
......@@ -316,7 +316,7 @@ void LiftoffAssembler::FillStackSlotsWithZero(int start, int size) {
bind(&loop);
StoreU64(r0, MemOperand(r0));
la(r0, MemOperand(r0, kSystemPointerSize));
CmpLogicalP(r3, r4);
CmpU64(r3, r4);
bne(&loop);
pop(r4);
......@@ -604,30 +604,30 @@ void LiftoffAssembler::emit_cond_jump(LiftoffCondition liftoff_cond,
if (type.kind() == ValueType::kI32) {
if (rhs == no_reg) {
if (use_signed) {
Cmp32(lhs, Operand::Zero());
CmpS32(lhs, Operand::Zero());
} else {
CmpLogical32(lhs, Operand::Zero());
CmpU32(lhs, Operand::Zero());
}
} else {
if (use_signed) {
Cmp32(lhs, rhs);
CmpS32(lhs, rhs);
} else {
CmpLogical32(lhs, rhs);
CmpU32(lhs, rhs);
}
}
} else {
CHECK_EQ(type.kind(), ValueType::kI64);
if (rhs == no_reg) {
if (use_signed) {
CmpP(lhs, Operand::Zero());
CmpS64(lhs, Operand::Zero());
} else {
CmpLogicalP(lhs, Operand::Zero());
CmpU64(lhs, Operand::Zero());
}
} else {
if (use_signed) {
CmpP(lhs, rhs);
CmpS64(lhs, rhs);
} else {
CmpLogicalP(lhs, rhs);
CmpU64(lhs, rhs);
}
}
}
......@@ -658,9 +658,9 @@ void LiftoffAssembler::emit_i32_set_cond(LiftoffCondition liftoff_cond,
Register rhs) {
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (use_signed) {
Cmp32(lhs, rhs);
CmpS32(lhs, rhs);
} else {
CmpLogical32(lhs, rhs);
CmpU32(lhs, rhs);
}
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
......@@ -675,9 +675,9 @@ void LiftoffAssembler::emit_i64_set_cond(LiftoffCondition liftoff_cond,
LiftoffRegister rhs) {
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (use_signed) {
CmpP(lhs.gp(), rhs.gp());
CmpS64(lhs.gp(), rhs.gp());
} else {
CmpLogicalP(lhs.gp(), rhs.gp());
CmpU64(lhs.gp(), rhs.gp());
}
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
......
......@@ -47,7 +47,7 @@ TEST_F(TurboAssemblerTest, TestCheck) {
// Fail if the first parameter is 17.
__ lgfi(r3, Operand(17));
__ CmpP(r2, r3); // 1st parameter is in {r2}.
__ CmpS64(r2, r3); // 1st parameter is in {r2}.
__ Check(Condition::ne, AbortReason::kNoReason);
__ Ret();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment