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

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

Issue 1762743002: S390: Initial impl of turbofan compiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/wasm-linkage.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/ppc/instruction-selector-ppc.cc b/src/compiler/s390/instruction-selector-s390.cc
similarity index 80%
copy from src/compiler/ppc/instruction-selector-ppc.cc
copy to src/compiler/s390/instruction-selector-s390.cc
index e89506262489db0fa0565240426396571f22d73a..179d88e85751a0c04e024a4138488ed5d3d8237e 100644
--- a/src/compiler/ppc/instruction-selector-ppc.cc
+++ b/src/compiler/s390/instruction-selector-s390.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
+// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,7 @@
#include "src/compiler/instruction-selector-impl.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
-#include "src/ppc/frames-ppc.h"
+#include "src/s390/frames-s390.h"
namespace v8 {
namespace internal {
@@ -22,11 +22,10 @@ enum ImmediateMode {
kNoImmediate
};
-
-// Adds PPC-specific methods for generating operands.
-class PPCOperandGenerator final : public OperandGenerator {
+// Adds S390-specific methods for generating operands.
+class S390OperandGenerator final : public OperandGenerator {
public:
- explicit PPCOperandGenerator(InstructionSelector* selector)
+ explicit S390OperandGenerator(InstructionSelector* selector)
: OperandGenerator(selector) {}
InstructionOperand UseOperand(Node* node, ImmediateMode mode) {
@@ -68,37 +67,33 @@ class PPCOperandGenerator final : public OperandGenerator {
}
};
-
namespace {
void VisitRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
-
void VisitRRR(InstructionSelector* selector, ArchOpcode opcode, Node* node) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)),
g.UseRegister(node->InputAt(1)));
}
-
void VisitRRO(InstructionSelector* selector, ArchOpcode opcode, Node* node,
ImmediateMode operand_mode) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)),
g.UseOperand(node->InputAt(1), operand_mode));
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void VisitTryTruncateDouble(InstructionSelector* selector, ArchOpcode opcode,
Node* node) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))};
InstructionOperand outputs[2];
size_t output_count = 0;
@@ -113,13 +108,12 @@ void VisitTryTruncateDouble(InstructionSelector* selector, ArchOpcode opcode,
}
#endif
-
// Shared routine for multiple binary operations.
template <typename Matcher>
void VisitBinop(InstructionSelector* selector, Node* node,
InstructionCode opcode, ImmediateMode operand_mode,
FlagsContinuation* cont) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
Matcher m(node);
InstructionOperand inputs[4];
size_t input_count = 0;
@@ -153,7 +147,6 @@ void VisitBinop(InstructionSelector* selector, Node* node,
}
}
-
// Shared routine for multiple binary operations.
template <typename Matcher>
void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode,
@@ -164,46 +157,45 @@ void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode,
} // namespace
-
void InstructionSelector::VisitLoad(Node* node) {
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* offset = node->InputAt(1);
ArchOpcode opcode = kArchNop;
ImmediateMode mode = kInt16Imm;
switch (load_rep.representation()) {
case MachineRepresentation::kFloat32:
- opcode = kPPC_LoadFloat32;
+ opcode = kS390_LoadFloat32;
break;
case MachineRepresentation::kFloat64:
- opcode = kPPC_LoadDouble;
+ opcode = kS390_LoadDouble;
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kWord8:
- opcode = load_rep.IsSigned() ? kPPC_LoadWordS8 : kPPC_LoadWordU8;
+ opcode = load_rep.IsSigned() ? kS390_LoadWordS8 : kS390_LoadWordU8;
break;
case MachineRepresentation::kWord16:
- opcode = load_rep.IsSigned() ? kPPC_LoadWordS16 : kPPC_LoadWordU16;
+ opcode = load_rep.IsSigned() ? kS390_LoadWordS16 : kS390_LoadWordU16;
break;
-#if !V8_TARGET_ARCH_PPC64
+#if !V8_TARGET_ARCH_S390X
case MachineRepresentation::kTagged: // Fall through.
#endif
case MachineRepresentation::kWord32:
- opcode = kPPC_LoadWordS32;
-#if V8_TARGET_ARCH_PPC64
- // TODO(mbrandy): this applies to signed loads only (lwa)
+ opcode = kS390_LoadWordS32;
+#if V8_TARGET_ARCH_S390X
+ // TODO(john.yan): Remove this mode since s390 do not has this restriction
mode = kInt16Imm_4ByteAligned;
#endif
break;
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case MachineRepresentation::kTagged: // Fall through.
case MachineRepresentation::kWord64:
- opcode = kPPC_LoadWord64;
+ opcode = kS390_LoadWord64;
mode = kInt16Imm_4ByteAligned;
break;
#else
- case MachineRepresentation::kWord64: // Fall through.
+ case MachineRepresentation::kWord64: // Fall through.
#endif
case MachineRepresentation::kSimd128: // Fall through.
case MachineRepresentation::kNone:
@@ -222,9 +214,8 @@ void InstructionSelector::VisitLoad(Node* node) {
}
}
-
void InstructionSelector::VisitStore(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* offset = node->InputAt(1);
Node* value = node->InputAt(2);
@@ -239,10 +230,10 @@ void InstructionSelector::VisitStore(Node* node) {
InstructionOperand inputs[3];
size_t input_count = 0;
inputs[input_count++] = g.UseUniqueRegister(base);
- // OutOfLineRecordWrite uses the offset in an 'add' instruction as well as
+ // OutOfLineRecordWrite uses the offset in an 'AddP' instruction as well as
// for the store itself, so we must check compatibility with both.
if (g.CanBeImmediate(offset, kInt16Imm)
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
&& g.CanBeImmediate(offset, kInt16Imm_4ByteAligned)
#endif
) {
@@ -281,28 +272,28 @@ void InstructionSelector::VisitStore(Node* node) {
ImmediateMode mode = kInt16Imm;
switch (rep) {
case MachineRepresentation::kFloat32:
- opcode = kPPC_StoreFloat32;
+ opcode = kS390_StoreFloat32;
break;
case MachineRepresentation::kFloat64:
- opcode = kPPC_StoreDouble;
+ opcode = kS390_StoreDouble;
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kWord8:
- opcode = kPPC_StoreWord8;
+ opcode = kS390_StoreWord8;
break;
case MachineRepresentation::kWord16:
- opcode = kPPC_StoreWord16;
+ opcode = kS390_StoreWord16;
break;
-#if !V8_TARGET_ARCH_PPC64
+#if !V8_TARGET_ARCH_S390X
case MachineRepresentation::kTagged: // Fall through.
#endif
case MachineRepresentation::kWord32:
- opcode = kPPC_StoreWord32;
+ opcode = kS390_StoreWord32;
break;
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case MachineRepresentation::kTagged: // Fall through.
case MachineRepresentation::kWord64:
- opcode = kPPC_StoreWord64;
+ opcode = kS390_StoreWord64;
mode = kInt16Imm_4ByteAligned;
break;
#else
@@ -326,10 +317,9 @@ void InstructionSelector::VisitStore(Node* node) {
}
}
-
void InstructionSelector::VisitCheckedLoad(Node* node) {
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* const base = node->InputAt(0);
Node* const offset = node->InputAt(1);
Node* const length = node->InputAt(2);
@@ -344,7 +334,7 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
case MachineRepresentation::kWord32:
opcode = kCheckedLoadWord32;
break;
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case MachineRepresentation::kWord64:
opcode = kCheckedLoadWord64;
break;
@@ -357,7 +347,7 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kTagged: // Fall through.
-#if !V8_TARGET_ARCH_PPC64
+#if !V8_TARGET_ARCH_S390X
case MachineRepresentation::kWord64: // Fall through.
#endif
case MachineRepresentation::kSimd128: // Fall through.
@@ -371,10 +361,9 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
g.UseOperand(length, kInt16Imm_Unsigned));
}
-
void InstructionSelector::VisitCheckedStore(Node* node) {
MachineRepresentation rep = CheckedStoreRepresentationOf(node->op());
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* const base = node->InputAt(0);
Node* const offset = node->InputAt(1);
Node* const length = node->InputAt(2);
@@ -390,7 +379,7 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
case MachineRepresentation::kWord32:
opcode = kCheckedStoreWord32;
break;
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case MachineRepresentation::kWord64:
opcode = kCheckedStoreWord64;
break;
@@ -403,7 +392,7 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
break;
case MachineRepresentation::kBit: // Fall through.
case MachineRepresentation::kTagged: // Fall through.
-#if !V8_TARGET_ARCH_PPC64
+#if !V8_TARGET_ARCH_S390X
case MachineRepresentation::kWord64: // Fall through.
#endif
case MachineRepresentation::kSimd128: // Fall through.
@@ -417,21 +406,20 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
g.UseOperand(length, kInt16Imm_Unsigned), g.UseRegister(value));
}
-
template <typename Matcher>
static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m,
ArchOpcode opcode, bool left_can_cover,
bool right_can_cover, ImmediateMode imm_mode) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
// Map instruction to equivalent operation with inverted right input.
ArchOpcode inv_opcode = opcode;
switch (opcode) {
- case kPPC_And:
- inv_opcode = kPPC_AndComplement;
+ case kS390_And:
+ inv_opcode = kS390_AndComplement;
break;
- case kPPC_Or:
- inv_opcode = kPPC_OrComplement;
+ case kS390_Or:
+ inv_opcode = kS390_OrComplement;
break;
default:
UNREACHABLE();
@@ -464,7 +452,6 @@ static void VisitLogical(InstructionSelector* selector, Node* node, Matcher* m,
VisitBinop<Matcher>(selector, node, opcode, imm_mode);
}
-
static inline bool IsContiguousMask32(uint32_t value, int* mb, int* me) {
int mask_width = base::bits::CountPopulation32(value);
int mask_msb = base::bits::CountLeadingZeros32(value);
@@ -476,8 +463,7 @@ static inline bool IsContiguousMask32(uint32_t value, int* mb, int* me) {
return true;
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
static inline bool IsContiguousMask64(uint64_t value, int* mb, int* me) {
int mask_width = base::bits::CountPopulation64(value);
int mask_msb = base::bits::CountLeadingZeros64(value);
@@ -490,10 +476,8 @@ static inline bool IsContiguousMask64(uint64_t value, int* mb, int* me) {
}
#endif
-
-// TODO(mbrandy): Absorb rotate-right into rlwinm?
void InstructionSelector::VisitWord32And(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
int mb = 0;
int me = 0;
@@ -502,7 +486,6 @@ void InstructionSelector::VisitWord32And(Node* node) {
Node* left = m.left().node();
if ((m.left().IsWord32Shr() || m.left().IsWord32Shl()) &&
CanCover(node, left)) {
- // Try to absorb left/right shift into rlwinm
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().IsInRange(0, 31)) {
left = mleft.left().node();
@@ -518,21 +501,20 @@ void InstructionSelector::VisitWord32And(Node* node) {
}
}
if (mb >= me) {
- Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node), g.UseRegister(left),
- g.TempImmediate(sh), g.TempImmediate(mb), g.TempImmediate(me));
+ Emit(kS390_RotLeftAndMask32, g.DefineAsRegister(node),
+ g.UseRegister(left), g.TempImmediate(sh), g.TempImmediate(mb),
+ g.TempImmediate(me));
return;
}
}
VisitLogical<Int32BinopMatcher>(
- this, node, &m, kPPC_And, CanCover(node, m.left().node()),
+ this, node, &m, kS390_And, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
-
-#if V8_TARGET_ARCH_PPC64
-// TODO(mbrandy): Absorb rotate-right into rldic?
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64And(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int64BinopMatcher m(node);
int mb = 0;
int me = 0;
@@ -541,7 +523,6 @@ void InstructionSelector::VisitWord64And(Node* node) {
Node* left = m.left().node();
if ((m.left().IsWord64Shr() || m.left().IsWord64Shl()) &&
CanCover(node, left)) {
- // Try to absorb left/right shift into rldic
Int64BinopMatcher mleft(m.left().node());
if (mleft.right().IsInRange(0, 63)) {
left = mleft.left().node();
@@ -562,15 +543,15 @@ void InstructionSelector::VisitWord64And(Node* node) {
int mask;
if (me == 0) {
match = true;
- opcode = kPPC_RotLeftAndClearLeft64;
+ opcode = kS390_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
- opcode = kPPC_RotLeftAndClearRight64;
+ opcode = kS390_RotLeftAndClearRight64;
mask = me;
} else if (sh && me <= sh && m.left().IsWord64Shl()) {
match = true;
- opcode = kPPC_RotLeftAndClear64;
+ opcode = kS390_RotLeftAndClear64;
mask = mb;
}
if (match) {
@@ -581,59 +562,53 @@ void InstructionSelector::VisitWord64And(Node* node) {
}
}
VisitLogical<Int64BinopMatcher>(
- this, node, &m, kPPC_And, CanCover(node, m.left().node()),
+ this, node, &m, kS390_And, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#endif
-
void InstructionSelector::VisitWord32Or(Node* node) {
Int32BinopMatcher m(node);
VisitLogical<Int32BinopMatcher>(
- this, node, &m, kPPC_Or, CanCover(node, m.left().node()),
+ this, node, &m, kS390_Or, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Or(Node* node) {
Int64BinopMatcher m(node);
VisitLogical<Int64BinopMatcher>(
- this, node, &m, kPPC_Or, CanCover(node, m.left().node()),
+ this, node, &m, kS390_Or, CanCover(node, m.left().node()),
CanCover(node, m.right().node()), kInt16Imm_Unsigned);
}
#endif
-
void InstructionSelector::VisitWord32Xor(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.right().Is(-1)) {
- Emit(kPPC_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
+ Emit(kS390_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
} else {
- VisitBinop<Int32BinopMatcher>(this, node, kPPC_Xor, kInt16Imm_Unsigned);
+ VisitBinop<Int32BinopMatcher>(this, node, kS390_Xor, kInt16Imm_Unsigned);
}
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Xor(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.right().Is(-1)) {
- Emit(kPPC_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
+ Emit(kS390_Not, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
} else {
- VisitBinop<Int64BinopMatcher>(this, node, kPPC_Xor, kInt16Imm_Unsigned);
+ VisitBinop<Int64BinopMatcher>(this, node, kS390_Xor, kInt16Imm_Unsigned);
}
}
#endif
-
void InstructionSelector::VisitWord32Shl(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
- // Try to absorb logical-and into rlwinm
Int32BinopMatcher mleft(m.left().node());
int sh = m.right().Value();
int mb;
@@ -643,24 +618,22 @@ void InstructionSelector::VisitWord32Shl(Node* node) {
// Adjust the mask such that it doesn't include any rotated bits.
if (me < sh) me = sh;
if (mb >= me) {
- Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node),
+ Emit(kS390_RotLeftAndMask32, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mb), g.TempImmediate(me));
return;
}
}
}
- VisitRRO(this, kPPC_ShiftLeft32, node, kShift32Imm);
+ VisitRRO(this, kS390_ShiftLeft32, node, kShift32Imm);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Shl(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int64BinopMatcher m(node);
// TODO(mbrandy): eliminate left sign extension if right >= 32
if (m.left().IsWord64And() && m.right().IsInRange(0, 63)) {
- // Try to absorb logical-and into rldic
Int64BinopMatcher mleft(m.left().node());
int sh = m.right().Value();
int mb;
@@ -675,15 +648,15 @@ void InstructionSelector::VisitWord64Shl(Node* node) {
int mask;
if (me == 0) {
match = true;
- opcode = kPPC_RotLeftAndClearLeft64;
+ opcode = kS390_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
- opcode = kPPC_RotLeftAndClearRight64;
+ opcode = kS390_RotLeftAndClearRight64;
mask = me;
} else if (sh && me <= sh) {
match = true;
- opcode = kPPC_RotLeftAndClear64;
+ opcode = kS390_RotLeftAndClear64;
mask = mb;
}
if (match) {
@@ -695,16 +668,14 @@ void InstructionSelector::VisitWord64Shl(Node* node) {
}
}
}
- VisitRRO(this, kPPC_ShiftLeft64, node, kShift64Imm);
+ VisitRRO(this, kS390_ShiftLeft64, node, kShift64Imm);
}
#endif
-
void InstructionSelector::VisitWord32Shr(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
- // Try to absorb logical-and into rlwinm
Int32BinopMatcher mleft(m.left().node());
int sh = m.right().Value();
int mb;
@@ -715,23 +686,21 @@ void InstructionSelector::VisitWord32Shr(Node* node) {
if (mb > 31 - sh) mb = 31 - sh;
sh = (32 - sh) & 0x1f;
if (mb >= me) {
- Emit(kPPC_RotLeftAndMask32, g.DefineAsRegister(node),
+ Emit(kS390_RotLeftAndMask32, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()), g.TempImmediate(sh),
g.TempImmediate(mb), g.TempImmediate(me));
return;
}
}
}
- VisitRRO(this, kPPC_ShiftRight32, node, kShift32Imm);
+ VisitRRO(this, kS390_ShiftRight32, node, kShift32Imm);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Shr(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.left().IsWord64And() && m.right().IsInRange(0, 63)) {
- // Try to absorb logical-and into rldic
Int64BinopMatcher mleft(m.left().node());
int sh = m.right().Value();
int mb;
@@ -747,11 +716,11 @@ void InstructionSelector::VisitWord64Shr(Node* node) {
int mask;
if (me == 0) {
match = true;
- opcode = kPPC_RotLeftAndClearLeft64;
+ opcode = kS390_RotLeftAndClearLeft64;
mask = mb;
} else if (mb == 63) {
match = true;
- opcode = kPPC_RotLeftAndClearRight64;
+ opcode = kS390_RotLeftAndClearRight64;
mask = me;
}
if (match) {
@@ -763,381 +732,323 @@ void InstructionSelector::VisitWord64Shr(Node* node) {
}
}
}
- VisitRRO(this, kPPC_ShiftRight64, node, kShift64Imm);
+ VisitRRO(this, kS390_ShiftRight64, node, kShift64Imm);
}
#endif
-
void InstructionSelector::VisitWord32Sar(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
// Replace with sign extension for (x << K) >> K where K is 16 or 24.
if (CanCover(node, m.left().node()) && m.left().IsWord32Shl()) {
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().Is(16) && m.right().Is(16)) {
- Emit(kPPC_ExtendSignWord16, g.DefineAsRegister(node),
+ Emit(kS390_ExtendSignWord16, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()));
return;
} else if (mleft.right().Is(24) && m.right().Is(24)) {
- Emit(kPPC_ExtendSignWord8, g.DefineAsRegister(node),
+ Emit(kS390_ExtendSignWord8, g.DefineAsRegister(node),
g.UseRegister(mleft.left().node()));
return;
}
}
- VisitRRO(this, kPPC_ShiftRightAlg32, node, kShift32Imm);
+ VisitRRO(this, kS390_ShiftRightAlg32, node, kShift32Imm);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Sar(Node* node) {
- VisitRRO(this, kPPC_ShiftRightAlg64, node, kShift64Imm);
+ VisitRRO(this, kS390_ShiftRightAlg64, node, kShift64Imm);
}
#endif
-
-// TODO(mbrandy): Absorb logical-and into rlwinm?
void InstructionSelector::VisitWord32Ror(Node* node) {
- VisitRRO(this, kPPC_RotRight32, node, kShift32Imm);
+ VisitRRO(this, kS390_RotRight32, node, kShift32Imm);
}
-
-#if V8_TARGET_ARCH_PPC64
-// TODO(mbrandy): Absorb logical-and into rldic?
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Ror(Node* node) {
- VisitRRO(this, kPPC_RotRight64, node, kShift64Imm);
+ VisitRRO(this, kS390_RotRight64, node, kShift64Imm);
}
#endif
-
void InstructionSelector::VisitWord32Clz(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_Cntlz32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
+ S390OperandGenerator g(this);
+ Emit(kS390_Cntlz32, g.DefineAsRegister(node),
+ g.UseRegister(node->InputAt(0)));
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Clz(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_Cntlz64, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
+ S390OperandGenerator g(this);
+ Emit(kS390_Cntlz64, g.DefineAsRegister(node),
+ g.UseRegister(node->InputAt(0)));
}
#endif
-
void InstructionSelector::VisitWord32Popcnt(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_Popcnt32, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_Popcnt32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Popcnt(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_Popcnt64, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_Popcnt64, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
#endif
-
void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); }
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); }
#endif
-
void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); }
#endif
-
void InstructionSelector::VisitInt32Add(Node* node) {
- VisitBinop<Int32BinopMatcher>(this, node, kPPC_Add, kInt16Imm);
+ VisitBinop<Int32BinopMatcher>(this, node, kS390_Add, kInt16Imm);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64Add(Node* node) {
- VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm);
+ VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm);
}
#endif
-
void InstructionSelector::VisitInt32Sub(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.left().Is(0)) {
- Emit(kPPC_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
+ Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
} else {
- VisitBinop<Int32BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate);
+ VisitBinop<Int32BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate);
}
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64Sub(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Int64BinopMatcher m(node);
if (m.left().Is(0)) {
- Emit(kPPC_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
+ Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node()));
} else {
- VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate);
+ VisitBinop<Int64BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate);
}
}
#endif
-
void InstructionSelector::VisitInt32Mul(Node* node) {
- VisitRRR(this, kPPC_Mul32, node);
+ VisitRRR(this, kS390_Mul32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64Mul(Node* node) {
- VisitRRR(this, kPPC_Mul64, node);
+ VisitRRR(this, kS390_Mul64, node);
}
#endif
-
void InstructionSelector::VisitInt32MulHigh(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_MulHigh32, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_MulHigh32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)));
}
-
void InstructionSelector::VisitUint32MulHigh(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_MulHighU32, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_MulHighU32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)));
}
-
void InstructionSelector::VisitInt32Div(Node* node) {
- VisitRRR(this, kPPC_Div32, node);
+ VisitRRR(this, kS390_Div32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64Div(Node* node) {
- VisitRRR(this, kPPC_Div64, node);
+ VisitRRR(this, kS390_Div64, node);
}
#endif
-
void InstructionSelector::VisitUint32Div(Node* node) {
- VisitRRR(this, kPPC_DivU32, node);
+ VisitRRR(this, kS390_DivU32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitUint64Div(Node* node) {
- VisitRRR(this, kPPC_DivU64, node);
+ VisitRRR(this, kS390_DivU64, node);
}
#endif
-
void InstructionSelector::VisitInt32Mod(Node* node) {
- VisitRRR(this, kPPC_Mod32, node);
+ VisitRRR(this, kS390_Mod32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64Mod(Node* node) {
- VisitRRR(this, kPPC_Mod64, node);
+ VisitRRR(this, kS390_Mod64, node);
}
#endif
-
void InstructionSelector::VisitUint32Mod(Node* node) {
- VisitRRR(this, kPPC_ModU32, node);
+ VisitRRR(this, kS390_ModU32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitUint64Mod(Node* node) {
- VisitRRR(this, kPPC_ModU64, node);
+ VisitRRR(this, kS390_ModU64, node);
}
#endif
-
void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) {
- VisitRR(this, kPPC_Float32ToDouble, node);
+ VisitRR(this, kS390_Float32ToDouble, node);
}
-
void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) {
- VisitRR(this, kPPC_Int32ToFloat32, node);
+ VisitRR(this, kS390_Int32ToFloat32, node);
}
-
void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
- VisitRR(this, kPPC_Uint32ToFloat32, node);
+ VisitRR(this, kS390_Uint32ToFloat32, node);
}
-
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
- VisitRR(this, kPPC_Int32ToDouble, node);
+ VisitRR(this, kS390_Int32ToDouble, node);
}
-
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
- VisitRR(this, kPPC_Uint32ToDouble, node);
+ VisitRR(this, kS390_Uint32ToDouble, node);
}
-
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
- VisitRR(this, kPPC_DoubleToInt32, node);
+ VisitRR(this, kS390_DoubleToInt32, node);
}
-
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
- VisitRR(this, kPPC_DoubleToUint32, node);
+ VisitRR(this, kS390_DoubleToUint32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) {
- VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node);
+ VisitTryTruncateDouble(this, kS390_Float32ToInt64, node);
}
-
void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) {
- VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node);
+ VisitTryTruncateDouble(this, kS390_DoubleToInt64, node);
}
-
void InstructionSelector::VisitTryTruncateFloat32ToUint64(Node* node) {
- VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node);
+ VisitTryTruncateDouble(this, kS390_Float32ToUint64, node);
}
-
void InstructionSelector::VisitTryTruncateFloat64ToUint64(Node* node) {
- VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node);
+ VisitTryTruncateDouble(this, kS390_DoubleToUint64, node);
}
-
void InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
- VisitRR(this, kPPC_ExtendSignWord32, node);
+ VisitRR(this, kS390_ExtendSignWord32, node);
}
-
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
- VisitRR(this, kPPC_Uint32ToUint64, node);
+ VisitRR(this, kS390_Uint32ToUint64, node);
}
#endif
-
void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
- VisitRR(this, kPPC_DoubleToFloat32, node);
+ VisitRR(this, kS390_DoubleToFloat32, node);
}
-
void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
switch (TruncationModeOf(node->op())) {
case TruncationMode::kJavaScript:
return VisitRR(this, kArchTruncateDoubleToI, node);
case TruncationMode::kRoundToZero:
- return VisitRR(this, kPPC_DoubleToInt32, node);
+ return VisitRR(this, kS390_DoubleToInt32, node);
}
UNREACHABLE();
}
-
void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) {
- VisitRR(this, kPPC_DoubleToInt32, node);
+ VisitRR(this, kS390_Float32ToInt32, node);
}
-
void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) {
- VisitRR(this, kPPC_DoubleToUint32, node);
+ VisitRR(this, kS390_Float32ToUint32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
- VisitRR(this, kPPC_Int64ToInt32, node);
+ VisitRR(this, kS390_Int64ToInt32, node);
}
-
void InstructionSelector::VisitRoundInt64ToFloat32(Node* node) {
- VisitRR(this, kPPC_Int64ToFloat32, node);
+ VisitRR(this, kS390_Int64ToFloat32, node);
}
-
void InstructionSelector::VisitRoundInt64ToFloat64(Node* node) {
- VisitRR(this, kPPC_Int64ToDouble, node);
+ VisitRR(this, kS390_Int64ToDouble, node);
}
-
void InstructionSelector::VisitRoundUint64ToFloat32(Node* node) {
- VisitRR(this, kPPC_Uint64ToFloat32, node);
+ VisitRR(this, kS390_Uint64ToFloat32, node);
}
-
void InstructionSelector::VisitRoundUint64ToFloat64(Node* node) {
- VisitRR(this, kPPC_Uint64ToDouble, node);
+ VisitRR(this, kS390_Uint64ToDouble, node);
}
#endif
-
void InstructionSelector::VisitBitcastFloat32ToInt32(Node* node) {
- VisitRR(this, kPPC_BitcastFloat32ToInt32, node);
+ VisitRR(this, kS390_BitcastFloat32ToInt32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitBitcastFloat64ToInt64(Node* node) {
- VisitRR(this, kPPC_BitcastDoubleToInt64, node);
+ VisitRR(this, kS390_BitcastDoubleToInt64, node);
}
#endif
-
void InstructionSelector::VisitBitcastInt32ToFloat32(Node* node) {
- VisitRR(this, kPPC_BitcastInt32ToFloat32, node);
+ VisitRR(this, kS390_BitcastInt32ToFloat32, node);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitBitcastInt64ToFloat64(Node* node) {
- VisitRR(this, kPPC_BitcastInt64ToDouble, node);
+ VisitRR(this, kS390_BitcastInt64ToDouble, node);
}
#endif
-
void InstructionSelector::VisitFloat32Add(Node* node) {
- VisitRRR(this, kPPC_AddDouble, node);
+ VisitRRR(this, kS390_AddFloat, node);
}
-
void InstructionSelector::VisitFloat64Add(Node* node) {
// TODO(mbrandy): detect multiply-add
- VisitRRR(this, kPPC_AddDouble, node);
+ VisitRRR(this, kS390_AddDouble, node);
}
-
void InstructionSelector::VisitFloat32Sub(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Float32BinopMatcher m(node);
if (m.left().IsMinusZero()) {
- Emit(kPPC_NegDouble, g.DefineAsRegister(node),
+ Emit(kS390_NegDouble, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
- VisitRRR(this, kPPC_SubDouble, node);
+ VisitRRR(this, kS390_SubFloat, node);
}
-
void InstructionSelector::VisitFloat64Sub(Node* node) {
// TODO(mbrandy): detect multiply-subtract
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Float64BinopMatcher m(node);
if (m.left().IsMinusZero()) {
if (m.right().IsFloat64RoundDown() &&
@@ -1147,174 +1058,147 @@ void InstructionSelector::VisitFloat64Sub(Node* node) {
Float64BinopMatcher mright0(m.right().InputAt(0));
if (mright0.left().IsMinusZero()) {
// -floor(-x) = ceil(x)
- Emit(kPPC_CeilDouble, g.DefineAsRegister(node),
+ Emit(kS390_CeilDouble, g.DefineAsRegister(node),
g.UseRegister(mright0.right().node()));
return;
}
}
}
- Emit(kPPC_NegDouble, g.DefineAsRegister(node),
+ Emit(kS390_NegDouble, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
- VisitRRR(this, kPPC_SubDouble, node);
+ VisitRRR(this, kS390_SubDouble, node);
}
-
void InstructionSelector::VisitFloat32Mul(Node* node) {
- VisitRRR(this, kPPC_MulDouble, node);
+ VisitRRR(this, kS390_MulFloat, node);
}
-
void InstructionSelector::VisitFloat64Mul(Node* node) {
// TODO(mbrandy): detect negate
- VisitRRR(this, kPPC_MulDouble, node);
+ VisitRRR(this, kS390_MulDouble, node);
}
-
void InstructionSelector::VisitFloat32Div(Node* node) {
- VisitRRR(this, kPPC_DivDouble, node);
+ VisitRRR(this, kS390_DivFloat, node);
}
-
void InstructionSelector::VisitFloat64Div(Node* node) {
- VisitRRR(this, kPPC_DivDouble, node);
+ VisitRRR(this, kS390_DivDouble, node);
}
-
void InstructionSelector::VisitFloat64Mod(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_ModDouble, g.DefineAsFixed(node, d1),
- g.UseFixed(node->InputAt(0), d1),
- g.UseFixed(node->InputAt(1), d2))->MarkAsCall();
+ S390OperandGenerator g(this);
+ Emit(kS390_ModDouble, g.DefineAsFixed(node, d1),
+ g.UseFixed(node->InputAt(0), d1), g.UseFixed(node->InputAt(1), d2))
+ ->MarkAsCall();
}
-
void InstructionSelector::VisitFloat32Max(Node* node) { UNREACHABLE(); }
-
void InstructionSelector::VisitFloat64Max(Node* node) { UNREACHABLE(); }
-
void InstructionSelector::VisitFloat32Min(Node* node) { UNREACHABLE(); }
-
void InstructionSelector::VisitFloat64Min(Node* node) { UNREACHABLE(); }
-
void InstructionSelector::VisitFloat32Abs(Node* node) {
- VisitRR(this, kPPC_AbsDouble, node);
+ VisitRR(this, kS390_AbsFloat, node);
}
-
void InstructionSelector::VisitFloat64Abs(Node* node) {
- VisitRR(this, kPPC_AbsDouble, node);
+ VisitRR(this, kS390_AbsDouble, node);
}
-
void InstructionSelector::VisitFloat32Sqrt(Node* node) {
- VisitRR(this, kPPC_SqrtDouble, node);
+ VisitRR(this, kS390_SqrtFloat, node);
}
-
void InstructionSelector::VisitFloat64Sqrt(Node* node) {
- VisitRR(this, kPPC_SqrtDouble, node);
+ VisitRR(this, kS390_SqrtDouble, node);
}
-
void InstructionSelector::VisitFloat32RoundDown(Node* node) {
- VisitRR(this, kPPC_FloorDouble, node);
+ VisitRR(this, kS390_FloorFloat, node);
}
-
void InstructionSelector::VisitFloat64RoundDown(Node* node) {
- VisitRR(this, kPPC_FloorDouble, node);
+ VisitRR(this, kS390_FloorDouble, node);
}
-
void InstructionSelector::VisitFloat32RoundUp(Node* node) {
- VisitRR(this, kPPC_CeilDouble, node);
+ VisitRR(this, kS390_CeilFloat, node);
}
-
void InstructionSelector::VisitFloat64RoundUp(Node* node) {
- VisitRR(this, kPPC_CeilDouble, node);
+ VisitRR(this, kS390_CeilDouble, node);
}
-
void InstructionSelector::VisitFloat32RoundTruncate(Node* node) {
- VisitRR(this, kPPC_TruncateDouble, node);
+ VisitRR(this, kS390_TruncateFloat, node);
}
-
void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
- VisitRR(this, kPPC_TruncateDouble, node);
+ VisitRR(this, kS390_TruncateDouble, node);
}
-
void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
- VisitRR(this, kPPC_RoundDouble, node);
+ VisitRR(this, kS390_RoundDouble, node);
}
-
void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
UNREACHABLE();
}
-
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
UNREACHABLE();
}
-
void InstructionSelector::VisitInt32AddWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
- return VisitBinop<Int32BinopMatcher>(this, node, kPPC_AddWithOverflow32,
+ return VisitBinop<Int32BinopMatcher>(this, node, kS390_AddWithOverflow32,
kInt16Imm, &cont);
}
FlagsContinuation cont;
- VisitBinop<Int32BinopMatcher>(this, node, kPPC_AddWithOverflow32, kInt16Imm,
+ VisitBinop<Int32BinopMatcher>(this, node, kS390_AddWithOverflow32, kInt16Imm,
&cont);
}
-
void InstructionSelector::VisitInt32SubWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
- return VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32,
+ return VisitBinop<Int32BinopMatcher>(this, node, kS390_SubWithOverflow32,
kInt16Imm_Negate, &cont);
}
FlagsContinuation cont;
- VisitBinop<Int32BinopMatcher>(this, node, kPPC_SubWithOverflow32,
+ VisitBinop<Int32BinopMatcher>(this, node, kS390_SubWithOverflow32,
kInt16Imm_Negate, &cont);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitInt64AddWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
- return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm,
+ return VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm,
&cont);
}
FlagsContinuation cont;
- VisitBinop<Int64BinopMatcher>(this, node, kPPC_Add, kInt16Imm, &cont);
+ VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm, &cont);
}
-
void InstructionSelector::VisitInt64SubWithOverflow(Node* node) {
if (Node* ovf = NodeProperties::FindProjection(node, 1)) {
FlagsContinuation cont = FlagsContinuation::ForSet(kOverflow, ovf);
- return VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate,
- &cont);
+ return VisitBinop<Int64BinopMatcher>(this, node, kS390_Sub,
+ kInt16Imm_Negate, &cont);
}
FlagsContinuation cont;
- VisitBinop<Int64BinopMatcher>(this, node, kPPC_Sub, kInt16Imm_Negate, &cont);
+ VisitBinop<Int64BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate, &cont);
}
#endif
-
static bool CompareLogical(FlagsContinuation* cont) {
switch (cont->condition()) {
case kUnsignedLessThan:
@@ -1329,14 +1213,13 @@ static bool CompareLogical(FlagsContinuation* cont) {
return false;
}
-
namespace {
// Shared routine for multiple compare operations.
void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
InstructionOperand left, InstructionOperand right,
FlagsContinuation* cont) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
opcode = cont->Encode(opcode);
if (cont->IsBranch()) {
selector->Emit(opcode, g.NoOutput(), left, right,
@@ -1350,12 +1233,11 @@ void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
}
}
-
// Shared routine for multiple word compare operations.
void VisitWordCompare(InstructionSelector* selector, Node* node,
InstructionCode opcode, FlagsContinuation* cont,
bool commutative, ImmediateMode immediate_mode) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
@@ -1373,45 +1255,40 @@ void VisitWordCompare(InstructionSelector* selector, Node* node,
}
}
-
void VisitWord32Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
ImmediateMode mode = (CompareLogical(cont) ? kInt16Imm_Unsigned : kInt16Imm);
- VisitWordCompare(selector, node, kPPC_Cmp32, cont, false, mode);
+ VisitWordCompare(selector, node, kS390_Cmp32, cont, false, mode);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void VisitWord64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
ImmediateMode mode = (CompareLogical(cont) ? kInt16Imm_Unsigned : kInt16Imm);
- VisitWordCompare(selector, node, kPPC_Cmp64, cont, false, mode);
+ VisitWordCompare(selector, node, kS390_Cmp64, cont, false, mode);
}
#endif
-
// Shared routine for multiple float32 compare operations.
void VisitFloat32Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
- VisitCompare(selector, kPPC_CmpDouble, g.UseRegister(left),
+ VisitCompare(selector, kS390_CmpFloat, g.UseRegister(left),
g.UseRegister(right), cont);
}
-
// Shared routine for multiple float64 compare operations.
void VisitFloat64Compare(InstructionSelector* selector, Node* node,
FlagsContinuation* cont) {
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
- VisitCompare(selector, kPPC_CmpDouble, g.UseRegister(left),
+ VisitCompare(selector, kS390_CmpDouble, g.UseRegister(left),
g.UseRegister(right), cont);
}
-
// Shared routine for word comparisons against zero.
void VisitWordCompareZero(InstructionSelector* selector, Node* user,
Node* value, InstructionCode opcode,
@@ -1443,7 +1320,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
case IrOpcode::kUint32LessThanOrEqual:
cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
return VisitWord32Compare(selector, value, cont);
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case IrOpcode::kWord64Equal:
cont->OverwriteAndNegateIfEqual(kEqual);
return VisitWord64Compare(selector, value, cont);
@@ -1494,20 +1371,20 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
case IrOpcode::kInt32AddWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int32BinopMatcher>(
- selector, node, kPPC_AddWithOverflow32, kInt16Imm, cont);
+ selector, node, kS390_AddWithOverflow32, kInt16Imm, cont);
case IrOpcode::kInt32SubWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
return VisitBinop<Int32BinopMatcher>(selector, node,
- kPPC_SubWithOverflow32,
+ kS390_SubWithOverflow32,
kInt16Imm_Negate, cont);
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case IrOpcode::kInt64AddWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
- return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Add,
+ return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Add,
kInt16Imm, cont);
case IrOpcode::kInt64SubWithOverflow:
cont->OverwriteAndNegateIfEqual(kOverflow);
- return VisitBinop<Int64BinopMatcher>(selector, node, kPPC_Sub,
+ return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Sub,
kInt16Imm_Negate, cont);
#endif
default:
@@ -1519,8 +1396,7 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
case IrOpcode::kInt32Sub:
return VisitWord32Compare(selector, value, cont);
case IrOpcode::kWord32And:
- // TODO(mbandy): opportunity for rlwinm?
- return VisitWordCompare(selector, value, kPPC_Tst32, cont, true,
+ return VisitWordCompare(selector, value, kS390_Tst32, cont, true,
kInt16Imm_Unsigned);
// TODO(mbrandy): Handle?
// case IrOpcode::kInt32Add:
@@ -1530,12 +1406,11 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
// case IrOpcode::kWord32Shl:
// case IrOpcode::kWord32Shr:
// case IrOpcode::kWord32Ror:
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
case IrOpcode::kInt64Sub:
return VisitWord64Compare(selector, value, cont);
case IrOpcode::kWord64And:
- // TODO(mbandy): opportunity for rldic?
- return VisitWordCompare(selector, value, kPPC_Tst64, cont, true,
+ return VisitWordCompare(selector, value, kS390_Tst64, cont, true,
kInt16Imm_Unsigned);
// TODO(mbrandy): Handle?
// case IrOpcode::kInt64Add:
@@ -1553,28 +1428,25 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
}
// Branch could not be combined with a compare, emit compare against 0.
- PPCOperandGenerator g(selector);
+ S390OperandGenerator g(selector);
VisitCompare(selector, opcode, g.UseRegister(value), g.TempImmediate(0),
cont);
}
-
void VisitWord32CompareZero(InstructionSelector* selector, Node* user,
Node* value, FlagsContinuation* cont) {
- VisitWordCompareZero(selector, user, value, kPPC_Cmp32, cont);
+ VisitWordCompareZero(selector, user, value, kS390_Cmp32, cont);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void VisitWord64CompareZero(InstructionSelector* selector, Node* user,
Node* value, FlagsContinuation* cont) {
- VisitWordCompareZero(selector, user, value, kPPC_Cmp64, cont);
+ VisitWordCompareZero(selector, user, value, kS390_Cmp64, cont);
}
#endif
} // namespace
-
void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
BasicBlock* fbranch) {
FlagsContinuation cont(kNotEqual, tbranch, fbranch);
@@ -1594,7 +1466,7 @@ void InstructionSelector::VisitDeoptimizeUnless(Node* node) {
}
void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
// Emit either ArchTableSwitch or ArchLookupSwitch.
@@ -1609,7 +1481,7 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
InstructionOperand index_operand = value_operand;
if (sw.min_value) {
index_operand = g.TempRegister();
- Emit(kPPC_Sub, index_operand, value_operand,
+ Emit(kS390_Sub, index_operand, value_operand,
g.TempImmediate(sw.min_value));
}
// Generate a table lookup.
@@ -1620,7 +1492,6 @@ void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
return EmitLookupSwitch(sw, value_operand);
}
-
void InstructionSelector::VisitWord32Equal(Node* const node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
Int32BinopMatcher m(node);
@@ -1630,34 +1501,29 @@ void InstructionSelector::VisitWord32Equal(Node* const node) {
VisitWord32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitInt32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node);
VisitWord32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitInt32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kSignedLessThanOrEqual, node);
VisitWord32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitUint32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitWord32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitWord32Compare(this, node, &cont);
}
-
-#if V8_TARGET_ARCH_PPC64
+#if V8_TARGET_ARCH_S390X
void InstructionSelector::VisitWord64Equal(Node* const node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
Int64BinopMatcher m(node);
@@ -1667,26 +1533,22 @@ void InstructionSelector::VisitWord64Equal(Node* const node) {
VisitWord64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitInt64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kSignedLessThan, node);
VisitWord64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kSignedLessThanOrEqual, node);
VisitWord64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitUint64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitWord64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
@@ -1694,49 +1556,42 @@ void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) {
}
#endif
-
void InstructionSelector::VisitFloat32Equal(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitFloat32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitFloat32LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitFloat32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitFloat32LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitFloat32Compare(this, node, &cont);
}
-
void InstructionSelector::VisitFloat64Equal(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node);
VisitFloat64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitFloat64LessThan(Node* node) {
FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node);
VisitFloat64Compare(this, node, &cont);
}
-
void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
FlagsContinuation cont =
FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node);
VisitFloat64Compare(this, node, &cont);
}
-
void InstructionSelector::EmitPrepareArguments(
ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor,
Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
// Prepare for C function call.
if (descriptor->IsCFunctionCall()) {
@@ -1747,7 +1602,7 @@ void InstructionSelector::EmitPrepareArguments(
// Poke any stack arguments.
int slot = kStackFrameExtraParamSlot;
for (PushParameter input : (*arguments)) {
- Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input.node()),
+ Emit(kS390_StoreToStackSlot, g.NoOutput(), g.UseRegister(input.node()),
g.TempImmediate(slot));
++slot;
}
@@ -1758,13 +1613,13 @@ void InstructionSelector::EmitPrepareArguments(
for (PushParameter input : (*arguments)) {
if (slot == 0) {
DCHECK(input.node());
- Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input.node()),
+ Emit(kS390_PushFrame, g.NoOutput(), g.UseRegister(input.node()),
g.TempImmediate(num_slots));
} else {
// Skip any alignment holes in pushed nodes.
if (input.node()) {
- Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input.node()),
- g.TempImmediate(slot));
+ Emit(kS390_StoreToStackSlot, g.NoOutput(),
+ g.UseRegister(input.node()), g.TempImmediate(slot));
}
}
++slot;
@@ -1772,56 +1627,50 @@ void InstructionSelector::EmitPrepareArguments(
}
}
-
bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
-
void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_DoubleExtractLowWord32, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_DoubleExtractLowWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
-
void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) {
- PPCOperandGenerator g(this);
- Emit(kPPC_DoubleExtractHighWord32, g.DefineAsRegister(node),
+ S390OperandGenerator g(this);
+ Emit(kS390_DoubleExtractHighWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
-
void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (left->opcode() == IrOpcode::kFloat64InsertHighWord32 &&
CanCover(node, left)) {
left = left->InputAt(1);
- Emit(kPPC_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(left),
+ Emit(kS390_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(left),
g.UseRegister(right));
return;
}
- Emit(kPPC_DoubleInsertLowWord32, g.DefineSameAsFirst(node),
+ Emit(kS390_DoubleInsertLowWord32, g.DefineSameAsFirst(node),
g.UseRegister(left), g.UseRegister(right));
}
-
void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
- PPCOperandGenerator g(this);
+ S390OperandGenerator g(this);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (left->opcode() == IrOpcode::kFloat64InsertLowWord32 &&
CanCover(node, left)) {
left = left->InputAt(1);
- Emit(kPPC_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(right),
+ Emit(kS390_DoubleConstruct, g.DefineAsRegister(node), g.UseRegister(right),
g.UseRegister(left));
return;
}
- Emit(kPPC_DoubleInsertHighWord32, g.DefineSameAsFirst(node),
+ Emit(kS390_DoubleInsertHighWord32, g.DefineSameAsFirst(node),
g.UseRegister(left), g.UseRegister(right));
}
-
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
@@ -1834,7 +1683,6 @@ InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::kFloat64RoundTiesAway |
MachineOperatorBuilder::kWord32Popcnt |
MachineOperatorBuilder::kWord64Popcnt;
- // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f.
}
} // namespace compiler
« no previous file with comments | « src/compiler/s390/instruction-scheduler-s390.cc ('k') | src/compiler/wasm-linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698