Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Unified Diff: src/compiler/s390/instruction-selector-s390.cc

Issue 2785773002: [turbofan] introduce Int32/64AbsWithOverflow optional operator (Closed)
Patch Set: add base impl Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/s390/instruction-scheduler-s390.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/s390/instruction-selector-s390.cc
diff --git a/src/compiler/s390/instruction-selector-s390.cc b/src/compiler/s390/instruction-selector-s390.cc
index 4b70e41ffdab884eb5ee8aae7fe74652c4cc9a54..802c499ee595d76441832223bc55961e8849248f 100644
--- a/src/compiler/s390/instruction-selector-s390.cc
+++ b/src/compiler/s390/instruction-selector-s390.cc
@@ -389,6 +389,11 @@ bool ProduceWord32Result(Node* node) {
switch (load_rep.representation()) {
case MachineRepresentation::kWord32:
return true;
+ case MachineRepresentation::kWord8:
+ if (load_rep.IsSigned())
+ return false;
+ else
+ return true;
default:
return false;
}
@@ -515,6 +520,8 @@ void VisitBinOp(InstructionSelector* selector, Node* node,
V(Word32, Unary, [](ArchOpcode opcode) { \
return opcode == kS390_LoadWordS32 || opcode == kS390_LoadWordU32; \
}) \
+ V(Word64, Unary, \
+ [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; }) \
V(Float32, Unary, \
[](ArchOpcode opcode) { return opcode == kS390_LoadFloat32; }) \
V(Float64, Unary, \
@@ -529,8 +536,6 @@ void VisitBinOp(InstructionSelector* selector, Node* node,
#if V8_TARGET_ARCH_S390X
#define VISIT_OP_LIST(V) \
VISIT_OP_LIST_32(V) \
- V(Word64, Unary, \
- [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; }) \
V(Word64, Bin, [](ArchOpcode opcode) { return opcode == kS390_LoadWord64; })
#else
#define VISIT_OP_LIST VISIT_OP_LIST_32
@@ -1242,6 +1247,14 @@ void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); }
#endif
+void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) {
+ VisitWord32UnaryOp(this, node, kS390_Abs32, OperandMode::kNone);
+}
+
+void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
+ VisitWord64UnaryOp(this, node, kS390_Abs64, OperandMode::kNone);
+}
+
void InstructionSelector::VisitWord64ReverseBytes(Node* node) {
S390OperandGenerator g(this);
Emit(kS390_LoadReverse64RR, g.DefineAsRegister(node),
@@ -2037,7 +2050,15 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
selector, node, kS390_Mul32WithOverflow,
OperandMode::kInt32Imm | OperandMode::kAllowDistinctOps,
cont);
+ case IrOpcode::kInt32AbsWithOverflow:
+ cont->OverwriteAndNegateIfEqual(kOverflow);
+ return VisitWord32UnaryOp(selector, node, kS390_Abs32,
+ OperandMode::kNone, cont);
#if V8_TARGET_ARCH_S390X
+ case IrOpcode::kInt64AbsWithOverflow:
+ cont->OverwriteAndNegateIfEqual(kOverflow);
+ return VisitWord64UnaryOp(selector, node, kS390_Abs64,
+ OperandMode::kNone, cont);
case IrOpcode::kInt64AddWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitWord64BinOp(selector, node, kS390_Add64,
@@ -2450,6 +2471,8 @@ InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::kWord32Popcnt |
MachineOperatorBuilder::kWord32ReverseBytes |
MachineOperatorBuilder::kWord64ReverseBytes |
+ MachineOperatorBuilder::kInt32AbsWithOverflow |
+ MachineOperatorBuilder::kInt64AbsWithOverflow |
MachineOperatorBuilder::kWord64Popcnt;
}
« no previous file with comments | « src/compiler/s390/instruction-scheduler-s390.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698