Commit e0f4f0b8 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

S390: Implement Float/Double NearestInt

Flags are also updated under `instruction-selector` to include
these operations. Not having them was causing their Simd versions
to remain unused as well. V8 was just interpreting them at runtime.

Change-Id: I42677f7412859ad4759b70ba16667ec9d90505af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2994803Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#75444}
parent 6f6bfe14
...@@ -1794,6 +1794,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1794,6 +1794,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ FloatMin(i.OutputDoubleRegister(), i.InputDoubleRegister(0), __ FloatMin(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
i.InputDoubleRegister(1)); i.InputDoubleRegister(1));
break; break;
case kS390_FloatNearestInt:
__ NearestIntF32(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
break;
case kS390_MinDouble: case kS390_MinDouble:
__ DoubleMin(i.OutputDoubleRegister(), i.InputDoubleRegister(0), __ DoubleMin(i.OutputDoubleRegister(), i.InputDoubleRegister(0),
i.InputDoubleRegister(1)); i.InputDoubleRegister(1));
...@@ -1814,6 +1817,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1814,6 +1817,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ fidbra(ROUND_TO_NEAREST_AWAY_FROM_0, i.OutputDoubleRegister(), __ fidbra(ROUND_TO_NEAREST_AWAY_FROM_0, i.OutputDoubleRegister(),
i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_DoubleNearestInt:
__ NearestIntF64(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
break;
case kS390_NegFloat: case kS390_NegFloat:
ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr); ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr);
break; break;
......
...@@ -69,12 +69,14 @@ namespace compiler { ...@@ -69,12 +69,14 @@ namespace compiler {
V(S390_FloorFloat) \ V(S390_FloorFloat) \
V(S390_CeilFloat) \ V(S390_CeilFloat) \
V(S390_TruncateFloat) \ V(S390_TruncateFloat) \
V(S390_FloatNearestInt) \
V(S390_AbsFloat) \ V(S390_AbsFloat) \
V(S390_SqrtDouble) \ V(S390_SqrtDouble) \
V(S390_FloorDouble) \ V(S390_FloorDouble) \
V(S390_CeilDouble) \ V(S390_CeilDouble) \
V(S390_TruncateDouble) \ V(S390_TruncateDouble) \
V(S390_RoundDouble) \ V(S390_RoundDouble) \
V(S390_DoubleNearestInt) \
V(S390_MaxFloat) \ V(S390_MaxFloat) \
V(S390_MaxDouble) \ V(S390_MaxDouble) \
V(S390_MinFloat) \ V(S390_MinFloat) \
......
...@@ -69,12 +69,14 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -69,12 +69,14 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_FloorFloat: case kS390_FloorFloat:
case kS390_CeilFloat: case kS390_CeilFloat:
case kS390_TruncateFloat: case kS390_TruncateFloat:
case kS390_FloatNearestInt:
case kS390_AbsFloat: case kS390_AbsFloat:
case kS390_SqrtDouble: case kS390_SqrtDouble:
case kS390_FloorDouble: case kS390_FloorDouble:
case kS390_CeilDouble: case kS390_CeilDouble:
case kS390_TruncateDouble: case kS390_TruncateDouble:
case kS390_RoundDouble: case kS390_RoundDouble:
case kS390_DoubleNearestInt:
case kS390_MaxFloat: case kS390_MaxFloat:
case kS390_MaxDouble: case kS390_MaxDouble:
case kS390_MinFloat: case kS390_MinFloat:
......
...@@ -1311,6 +1311,10 @@ static inline bool TryMatchDoubleConstructFromInsert( ...@@ -1311,6 +1311,10 @@ static inline bool TryMatchDoubleConstructFromInsert(
null) \ null) \
V(Float64, Float64RoundTiesAway, kS390_RoundDouble, OperandMode::kNone, \ V(Float64, Float64RoundTiesAway, kS390_RoundDouble, OperandMode::kNone, \
null) \ null) \
V(Float32, Float32RoundTiesEven, kS390_FloatNearestInt, OperandMode::kNone, \
null) \
V(Float64, Float64RoundTiesEven, kS390_DoubleNearestInt, OperandMode::kNone, \
null) \
V(Float32, Float32Neg, kS390_NegFloat, OperandMode::kNone, null) \ V(Float32, Float32Neg, kS390_NegFloat, OperandMode::kNone, null) \
V(Float64, Float64Neg, kS390_NegDouble, OperandMode::kNone, null) \ V(Float64, Float64Neg, kS390_NegDouble, OperandMode::kNone, null) \
/* TODO(john.yan): can use kAllowRM */ \ /* TODO(john.yan): can use kAllowRM */ \
...@@ -1557,14 +1561,6 @@ void InstructionSelector::VisitFloat64Ieee754Binop(Node* node, ...@@ -1557,14 +1561,6 @@ void InstructionSelector::VisitFloat64Ieee754Binop(Node* node,
->MarkAsCall(); ->MarkAsCall();
} }
void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
UNREACHABLE();
}
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
UNREACHABLE();
}
static bool CompareLogical(FlagsContinuation* cont) { static bool CompareLogical(FlagsContinuation* cont) {
switch (cont->condition()) { switch (cont->condition()) {
case kUnsignedLessThan: case kUnsignedLessThan:
...@@ -2875,6 +2871,8 @@ InstructionSelector::SupportedMachineOperatorFlags() { ...@@ -2875,6 +2871,8 @@ InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::kFloat64RoundUp | MachineOperatorBuilder::kFloat64RoundUp |
MachineOperatorBuilder::kFloat32RoundTruncate | MachineOperatorBuilder::kFloat32RoundTruncate |
MachineOperatorBuilder::kFloat64RoundTruncate | MachineOperatorBuilder::kFloat64RoundTruncate |
MachineOperatorBuilder::kFloat32RoundTiesEven |
MachineOperatorBuilder::kFloat64RoundTiesEven |
MachineOperatorBuilder::kFloat64RoundTiesAway | MachineOperatorBuilder::kFloat64RoundTiesAway |
MachineOperatorBuilder::kWord32Popcnt | MachineOperatorBuilder::kWord32Popcnt |
MachineOperatorBuilder::kInt32AbsWithOverflow | MachineOperatorBuilder::kInt32AbsWithOverflow |
......
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