Commit 907693d5 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

s390x: implement liftoff branches

Change-Id: Idbcc6a0a261357e1680ece3e7946618b6577d78e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2562125Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71445}
parent 304fd7cc
......@@ -14,6 +14,47 @@ namespace wasm {
namespace liftoff {
inline constexpr Condition ToCondition(LiftoffCondition liftoff_cond) {
switch (liftoff_cond) {
case kEqual:
return eq;
case kUnequal:
return ne;
case kSignedLessThan:
case kUnsignedLessThan:
return lt;
case kSignedLessEqual:
case kUnsignedLessEqual:
return le;
case kSignedGreaterEqual:
case kUnsignedGreaterEqual:
return ge;
case kSignedGreaterThan:
case kUnsignedGreaterThan:
return gt;
}
}
inline constexpr bool UseSignedOp(LiftoffCondition liftoff_cond) {
switch (liftoff_cond) {
case kEqual:
case kUnequal:
case kSignedLessThan:
case kSignedLessEqual:
case kSignedGreaterThan:
case kSignedGreaterEqual:
return true;
case kUnsignedLessThan:
case kUnsignedLessEqual:
case kUnsignedGreaterThan:
case kUnsignedGreaterEqual:
return false;
default:
UNREACHABLE();
}
return false;
}
// half
// slot Frame
// -----+--------------------+---------------------------
......@@ -516,24 +557,69 @@ void LiftoffAssembler::emit_jump(Label* label) {
bailout(kUnsupportedArchitecture, "emit_jump");
}
void LiftoffAssembler::emit_jump(Register target) {
bailout(kUnsupportedArchitecture, "emit_jump");
}
void LiftoffAssembler::emit_cond_jump(LiftoffCondition liftoff_cond,
Label* label, ValueType type,
Register lhs, Register rhs) {
bailout(kUnsupportedArchitecture, "emit_cond_jump");
Condition cond = liftoff::ToCondition(liftoff_cond);
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (type.kind() == ValueType::kI32) {
if (rhs == no_reg) {
if (use_signed) {
Cmp32(lhs, Operand::Zero());
} else {
CmpLogical32(lhs, Operand::Zero());
}
} else {
if (use_signed) {
Cmp32(lhs, rhs);
} else {
CmpLogical32(lhs, rhs);
}
}
} else {
CHECK_EQ(type.kind(), ValueType::kI64);
if (rhs == no_reg) {
if (use_signed) {
CmpP(lhs, Operand::Zero());
} else {
CmpLogicalP(lhs, Operand::Zero());
}
} else {
if (use_signed) {
CmpP(lhs, rhs);
} else {
CmpLogicalP(lhs, rhs);
}
}
}
b(cond, label);
}
void LiftoffAssembler::emit_i32_eqz(Register dst, Register src) {
bailout(kUnsupportedArchitecture, "emit_i32_eqz");
}
#define EMIT_SET_CONDITION(dst, cond) \
{ \
Label done; \
lghi(dst, Operand(1)); \
b(cond, &done); \
lghi(dst, Operand(0)); \
bind(&done); \
}
void LiftoffAssembler::emit_i32_set_cond(LiftoffCondition liftoff_cond,
Register dst, Register lhs,
Register rhs) {
bailout(kUnsupportedArchitecture, "emit_i32_set_cond");
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (use_signed) {
Cmp32(lhs, rhs);
} else {
CmpLogical32(lhs, rhs);
}
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
}
void LiftoffAssembler::emit_i64_eqz(Register dst, LiftoffRegister src) {
......@@ -543,19 +629,28 @@ void LiftoffAssembler::emit_i64_eqz(Register dst, LiftoffRegister src) {
void LiftoffAssembler::emit_i64_set_cond(LiftoffCondition liftoff_cond,
Register dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_i64_set_cond");
bool use_signed = liftoff::UseSignedOp(liftoff_cond);
if (use_signed) {
CmpP(lhs.gp(), rhs.gp());
} else {
CmpLogicalP(lhs.gp(), rhs.gp());
}
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
}
void LiftoffAssembler::emit_f32_set_cond(LiftoffCondition liftoff_cond,
Register dst, DoubleRegister lhs,
DoubleRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_f32_set_cond");
cebr(lhs, rhs);
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
}
void LiftoffAssembler::emit_f64_set_cond(LiftoffCondition liftoff_cond,
Register dst, DoubleRegister lhs,
DoubleRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_f64_set_cond");
cdbr(lhs, rhs);
EMIT_SET_CONDITION(dst, liftoff::ToCondition(liftoff_cond));
}
bool LiftoffAssembler::emit_select(LiftoffRegister dst, Register condition,
......
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