Commit f121194c authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

s390x: cleanup rounding constants

Drive-by: Add alias for lzer on Assembler
Change-Id: Id0d705ef864899241f77d92c2cf8a144f753ef15
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2552928Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71324}
parent 95efd8c1
......@@ -402,6 +402,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
S390_RRE_OPCODE_LIST(DECLARE_S390_RRE_INSTRUCTIONS)
// Special format
void lzdr(DoubleRegister r1) { rre_format(LZDR, r1.code(), 0); }
void lzer(DoubleRegister r1) { rre_format(LZER, r1.code(), 0); }
#undef DECLARE_S390_RRE_INSTRUCTIONS
#define DECLARE_S390_RX_INSTRUCTIONS(name, op_name, op_value) \
......@@ -677,15 +678,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
S390_RRF_E_OPCODE_LIST(DECLARE_S390_RRF_E_INSTRUCTIONS)
#undef DECLARE_S390_RRF_E_INSTRUCTIONS
enum FIDBRA_FLAGS {
FIDBRA_CURRENT_ROUNDING_MODE = 0,
FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0 = 1,
// ...
FIDBRA_ROUND_TOWARD_0 = 5,
FIDBRA_ROUND_TOWARD_POS_INF = 6,
FIDBRA_ROUND_TOWARD_NEG_INF = 7
};
inline void rsi_format(Opcode op, int f1, int f2, int f3) {
DCHECK(is_uint8(op));
DCHECK(is_uint16(f3) || is_int16(f3));
......
......@@ -101,16 +101,7 @@ enum Condition {
mask0xC = 12,
mask0xD = 13,
mask0xE = 14,
mask0xF = 15,
// Rounding modes for floating poing facility
CURRENT_ROUNDING_MODE = 0,
ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0 = 1,
ROUND_TO_PREPARE_FOR_SHORTER_PRECISION = 3,
ROUND_TO_NEAREST_WITH_TIES_TO_EVEN = 4,
ROUND_TOWARD_0 = 5,
ROUND_TOWARD_PLUS_INFINITE = 6,
ROUND_TOWARD_MINUS_INFINITE = 7
mask0xF = 15
};
inline Condition NegateCondition(Condition cond) {
......@@ -1787,16 +1778,18 @@ const int32_t kDefaultStopCode = -1;
// FP rounding modes.
enum FPRoundingMode {
RN = 0, // Round to Nearest.
RZ = 1, // Round towards zero.
RP = 2, // Round towards Plus Infinity.
RM = 3, // Round towards Minus Infinity.
CURRENT_ROUNDING_MODE = 0,
ROUND_TO_NEAREST_AWAY_FROM_0 = 1,
ROUND_TO_NEAREST_TO_EVEN = 4,
ROUND_TOWARD_0 = 5,
ROUND_TOWARD_POS_INF = 6,
ROUND_TOWARD_NEG_INF = 7,
// Aliases.
kRoundToNearest = RN,
kRoundToZero = RZ,
kRoundToPlusInf = RP,
kRoundToMinusInf = RM
kRoundToNearest = ROUND_TO_NEAREST_TO_EVEN,
kRoundToZero = ROUND_TOWARD_0,
kRoundToPlusInf = ROUND_TOWARD_POS_INF,
kRoundToMinusInf = ROUND_TOWARD_NEG_INF
};
const uint32_t kFPRoundingModeMask = 3;
......
......@@ -2047,16 +2047,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_UNARY_OP(D_DInstr(sqdbr), nullInstr, nullInstr);
break;
case kS390_FloorFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fiebra(ROUND_TOWARD_NEG_INF, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_CeilFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fiebra(ROUND_TOWARD_POS_INF, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_TruncateFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fiebra(ROUND_TOWARD_0, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
// Double operations
case kS390_ModDouble:
......@@ -2148,20 +2148,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ lpdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
break;
case kS390_FloorDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fidbra(ROUND_TOWARD_NEG_INF, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_CeilDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fidbra(ROUND_TOWARD_POS_INF, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_TruncateDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fidbra(ROUND_TOWARD_0, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_RoundDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0,
i.OutputDoubleRegister(), i.InputDoubleRegister(0));
__ fidbra(ROUND_TO_NEAREST_AWAY_FROM_0, i.OutputDoubleRegister(),
i.InputDoubleRegister(0));
break;
case kS390_NegFloat:
ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr);
......
......@@ -56,15 +56,15 @@ class CachePage {
template <class T>
static T ComputeRounding(T a, int mode) {
switch (mode) {
case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0:
case ROUND_TO_NEAREST_AWAY_FROM_0:
return std::round(a);
case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN:
case ROUND_TO_NEAREST_TO_EVEN:
return std::nearbyint(a);
case ROUND_TOWARD_0:
return std::trunc(a);
case ROUND_TOWARD_PLUS_INFINITE:
case ROUND_TOWARD_POS_INF:
return std::ceil(a);
case ROUND_TOWARD_MINUS_INFINITE:
case ROUND_TOWARD_NEG_INF:
return std::floor(a);
default:
UNIMPLEMENTED();
......
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