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 { ...@@ -402,6 +402,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
S390_RRE_OPCODE_LIST(DECLARE_S390_RRE_INSTRUCTIONS) S390_RRE_OPCODE_LIST(DECLARE_S390_RRE_INSTRUCTIONS)
// Special format // Special format
void lzdr(DoubleRegister r1) { rre_format(LZDR, r1.code(), 0); } 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 #undef DECLARE_S390_RRE_INSTRUCTIONS
#define DECLARE_S390_RX_INSTRUCTIONS(name, op_name, op_value) \ #define DECLARE_S390_RX_INSTRUCTIONS(name, op_name, op_value) \
...@@ -677,15 +678,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -677,15 +678,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
S390_RRF_E_OPCODE_LIST(DECLARE_S390_RRF_E_INSTRUCTIONS) S390_RRF_E_OPCODE_LIST(DECLARE_S390_RRF_E_INSTRUCTIONS)
#undef 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) { inline void rsi_format(Opcode op, int f1, int f2, int f3) {
DCHECK(is_uint8(op)); DCHECK(is_uint8(op));
DCHECK(is_uint16(f3) || is_int16(f3)); DCHECK(is_uint16(f3) || is_int16(f3));
......
...@@ -101,16 +101,7 @@ enum Condition { ...@@ -101,16 +101,7 @@ enum Condition {
mask0xC = 12, mask0xC = 12,
mask0xD = 13, mask0xD = 13,
mask0xE = 14, mask0xE = 14,
mask0xF = 15, 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
}; };
inline Condition NegateCondition(Condition cond) { inline Condition NegateCondition(Condition cond) {
...@@ -1787,16 +1778,18 @@ const int32_t kDefaultStopCode = -1; ...@@ -1787,16 +1778,18 @@ const int32_t kDefaultStopCode = -1;
// FP rounding modes. // FP rounding modes.
enum FPRoundingMode { enum FPRoundingMode {
RN = 0, // Round to Nearest. CURRENT_ROUNDING_MODE = 0,
RZ = 1, // Round towards zero. ROUND_TO_NEAREST_AWAY_FROM_0 = 1,
RP = 2, // Round towards Plus Infinity. ROUND_TO_NEAREST_TO_EVEN = 4,
RM = 3, // Round towards Minus Infinity. ROUND_TOWARD_0 = 5,
ROUND_TOWARD_POS_INF = 6,
ROUND_TOWARD_NEG_INF = 7,
// Aliases. // Aliases.
kRoundToNearest = RN, kRoundToNearest = ROUND_TO_NEAREST_TO_EVEN,
kRoundToZero = RZ, kRoundToZero = ROUND_TOWARD_0,
kRoundToPlusInf = RP, kRoundToPlusInf = ROUND_TOWARD_POS_INF,
kRoundToMinusInf = RM kRoundToMinusInf = ROUND_TOWARD_NEG_INF
}; };
const uint32_t kFPRoundingModeMask = 3; const uint32_t kFPRoundingModeMask = 3;
......
...@@ -2047,16 +2047,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2047,16 +2047,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_UNARY_OP(D_DInstr(sqdbr), nullInstr, nullInstr); ASSEMBLE_UNARY_OP(D_DInstr(sqdbr), nullInstr, nullInstr);
break; break;
case kS390_FloorFloat: case kS390_FloorFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF, __ fiebra(ROUND_TOWARD_NEG_INF, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_CeilFloat: case kS390_CeilFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF, __ fiebra(ROUND_TOWARD_POS_INF, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_TruncateFloat: case kS390_TruncateFloat:
__ fiebra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0, __ fiebra(ROUND_TOWARD_0, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
// Double operations // Double operations
case kS390_ModDouble: case kS390_ModDouble:
...@@ -2148,20 +2148,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2148,20 +2148,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ lpdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0)); __ lpdbr(i.OutputDoubleRegister(), i.InputDoubleRegister(0));
break; break;
case kS390_FloorDouble: case kS390_FloorDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_NEG_INF, __ fidbra(ROUND_TOWARD_NEG_INF, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_CeilDouble: case kS390_CeilDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_POS_INF, __ fidbra(ROUND_TOWARD_POS_INF, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_TruncateDouble: case kS390_TruncateDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TOWARD_0, __ fidbra(ROUND_TOWARD_0, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_RoundDouble: case kS390_RoundDouble:
__ fidbra(v8::internal::Assembler::FIDBRA_ROUND_TO_NEAREST_AWAY_FROM_0, __ fidbra(ROUND_TO_NEAREST_AWAY_FROM_0, i.OutputDoubleRegister(),
i.OutputDoubleRegister(), i.InputDoubleRegister(0)); i.InputDoubleRegister(0));
break; break;
case kS390_NegFloat: case kS390_NegFloat:
ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr); ASSEMBLE_UNARY_OP(D_DInstr(lcebr), nullInstr, nullInstr);
......
...@@ -56,15 +56,15 @@ class CachePage { ...@@ -56,15 +56,15 @@ class CachePage {
template <class T> template <class T>
static T ComputeRounding(T a, int mode) { static T ComputeRounding(T a, int mode) {
switch (mode) { switch (mode) {
case ROUND_TO_NEAREST_WITH_TIES_AWAY_FROM_0: case ROUND_TO_NEAREST_AWAY_FROM_0:
return std::round(a); return std::round(a);
case ROUND_TO_NEAREST_WITH_TIES_TO_EVEN: case ROUND_TO_NEAREST_TO_EVEN:
return std::nearbyint(a); return std::nearbyint(a);
case ROUND_TOWARD_0: case ROUND_TOWARD_0:
return std::trunc(a); return std::trunc(a);
case ROUND_TOWARD_PLUS_INFINITE: case ROUND_TOWARD_POS_INF:
return std::ceil(a); return std::ceil(a);
case ROUND_TOWARD_MINUS_INFINITE: case ROUND_TOWARD_NEG_INF:
return std::floor(a); return std::floor(a);
default: default:
UNIMPLEMENTED(); 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