From cce657cc555323b3048602d8b3d057b140d617c4 Mon Sep 17 00:00:00 2001 From: Junliang Yan Date: Mon, 21 Mar 2022 08:49:39 -0400 Subject: [PATCH] ppc64: [baseline] implement JumpIfHelper Change-Id: I8b879b79bfa596f778c904e0e7f0c4c788407356 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3539463 Reviewed-by: Milad Farazmand Commit-Queue: Junliang Yan Cr-Commit-Position: refs/heads/main@{#79546} --- src/baseline/ppc/baseline-assembler-ppc-inl.h | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/baseline/ppc/baseline-assembler-ppc-inl.h b/src/baseline/ppc/baseline-assembler-ppc-inl.h index 2058cd7ff3..910c40144e 100644 --- a/src/baseline/ppc/baseline-assembler-ppc-inl.h +++ b/src/baseline/ppc/baseline-assembler-ppc-inl.h @@ -110,12 +110,43 @@ inline internal::Condition AsMasmCondition(Condition cond) { namespace detail { -#ifdef DEBUG -inline bool Clobbers(Register target, MemOperand op) { - UNIMPLEMENTED(); - return false; +inline bool IsSignedCondition(Condition cond) { + switch (cond) { + case Condition::kEqual: + case Condition::kNotEqual: + case Condition::kLessThan: + case Condition::kGreaterThan: + case Condition::kLessThanEqual: + case Condition::kGreaterThanEqual: + case Condition::kOverflow: + case Condition::kNoOverflow: + case Condition::kZero: + case Condition::kNotZero: + return true; + + case Condition::kUnsignedLessThan: + case Condition::kUnsignedGreaterThan: + case Condition::kUnsignedLessThanEqual: + case Condition::kUnsignedGreaterThanEqual: + return false; + + default: + UNREACHABLE(); + } } -#endif + +#define __ assm-> +// ppc helper +static void JumpIfHelper(MacroAssembler* assm, Condition cc, Register lhs, + Register rhs, Label* target) { + if (IsSignedCondition(cc)) { + __ CmpS64(lhs, rhs); + } else { + __ CmpU64(lhs, rhs); + } + __ b(AsMasmCondition(cc), target); +} +#undef __ } // namespace detail