Commit 1d5013f9 authored by andrew-cc-chen's avatar andrew-cc-chen Committed by Commit Bot

[ppc] cleaned up atomic64 ops

Change-Id: Id27bfca6f49d4ec351988a597307558cd75ecf56
Reviewed-on: https://chromium-review.googlesource.com/c/1278499Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#56868}
parent 4b2282b3
......@@ -1979,82 +1979,69 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_ATOMIC_LOAD_INTEGER(lbz, lbzx);
__ extsb(i.OutputRegister(), i.OutputRegister());
break;
case kPPC_Word64AtomicLoadUint8:
case kWord32AtomicLoadUint8:
case kPPC_AtomicLoadUint8:
ASSEMBLE_ATOMIC_LOAD_INTEGER(lbz, lbzx);
break;
case kWord32AtomicLoadInt16:
ASSEMBLE_ATOMIC_LOAD_INTEGER(lha, lhax);
break;
case kPPC_Word64AtomicLoadUint16:
case kWord32AtomicLoadUint16:
case kPPC_AtomicLoadUint16:
ASSEMBLE_ATOMIC_LOAD_INTEGER(lhz, lhzx);
break;
case kPPC_Word64AtomicLoadUint32:
case kWord32AtomicLoadWord32:
case kPPC_AtomicLoadWord32:
ASSEMBLE_ATOMIC_LOAD_INTEGER(lwz, lwzx);
break;
case kPPC_Word64AtomicLoadUint64:
case kPPC_AtomicLoadWord64:
ASSEMBLE_ATOMIC_LOAD_INTEGER(ld, ldx);
break;
case kPPC_Word64AtomicStoreUint8:
case kWord32AtomicStoreWord8:
case kPPC_AtomicStoreUint8:
ASSEMBLE_ATOMIC_STORE_INTEGER(stb, stbx);
break;
case kPPC_Word64AtomicStoreUint16:
case kWord32AtomicStoreWord16:
case kPPC_AtomicStoreUint16:
ASSEMBLE_ATOMIC_STORE_INTEGER(sth, sthx);
break;
case kPPC_Word64AtomicStoreUint32:
case kWord32AtomicStoreWord32:
case kPPC_AtomicStoreWord32:
ASSEMBLE_ATOMIC_STORE_INTEGER(stw, stwx);
break;
case kPPC_Word64AtomicStoreUint64:
case kPPC_AtomicStoreWord64:
ASSEMBLE_ATOMIC_STORE_INTEGER(std, stdx);
break;
case kWord32AtomicExchangeInt8:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(lbarx, stbcx);
__ extsb(i.OutputRegister(0), i.OutputRegister(0));
break;
case kPPC_Word64AtomicExchangeUint8:
case kWord32AtomicExchangeUint8:
case kPPC_AtomicExchangeUint8:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(lbarx, stbcx);
break;
case kWord32AtomicExchangeInt16:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(lharx, sthcx);
__ extsh(i.OutputRegister(0), i.OutputRegister(0));
break;
case kPPC_Word64AtomicExchangeUint16:
case kWord32AtomicExchangeUint16:
case kPPC_AtomicExchangeUint16:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(lharx, sthcx);
break;
case kPPC_Word64AtomicExchangeUint32:
case kWord32AtomicExchangeWord32:
case kPPC_AtomicExchangeWord32:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(lwarx, stwcx);
break;
case kPPC_Word64AtomicExchangeUint64:
case kPPC_AtomicExchangeWord64:
ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldarx, stdcx);
break;
case kWord32AtomicCompareExchangeInt8:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_SIGN_EXT(cmp, lbarx, stbcx, extsb);
break;
case kPPC_Word64AtomicCompareExchangeUint8:
case kWord32AtomicCompareExchangeUint8:
case kPPC_AtomicCompareExchangeUint8:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE(cmp, lbarx, stbcx);
break;
case kWord32AtomicCompareExchangeInt16:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE_SIGN_EXT(cmp, lharx, sthcx, extsh);
break;
case kPPC_Word64AtomicCompareExchangeUint16:
case kWord32AtomicCompareExchangeUint16:
case kPPC_AtomicCompareExchangeUint16:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE(cmp, lharx, sthcx);
break;
case kPPC_Word64AtomicCompareExchangeUint32:
case kWord32AtomicCompareExchangeWord32:
case kPPC_AtomicCompareExchangeWord32:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE(cmpw, lwarx, stwcx);
break;
case kPPC_Word64AtomicCompareExchangeUint64:
case kPPC_AtomicCompareExchangeWord64:
ASSEMBLE_ATOMIC_COMPARE_EXCHANGE(cmp, ldarx, stdcx);
break;
......@@ -2062,20 +2049,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kWord32Atomic##op##Int8: \
ASSEMBLE_ATOMIC_BINOP_SIGN_EXT(inst, lbarx, stbcx, extsb); \
break; \
case kPPC_Word64Atomic##op##Uint8: \
case kWord32Atomic##op##Uint8: \
case kPPC_Atomic##op##Uint8: \
ASSEMBLE_ATOMIC_BINOP(inst, lbarx, stbcx); \
break; \
case kWord32Atomic##op##Int16: \
ASSEMBLE_ATOMIC_BINOP_SIGN_EXT(inst, lharx, sthcx, extsh); \
break; \
case kPPC_Word64Atomic##op##Uint16: \
case kWord32Atomic##op##Uint16: \
case kPPC_Atomic##op##Uint16: \
ASSEMBLE_ATOMIC_BINOP(inst, lharx, sthcx); \
break; \
case kPPC_Word64Atomic##op##Uint32: \
case kWord32Atomic##op##Word32: \
case kPPC_Atomic##op##Word32: \
ASSEMBLE_ATOMIC_BINOP(inst, lwarx, stwcx); \
break; \
case kPPC_Atomic##op##Word64: \
ASSEMBLE_ATOMIC_BINOP(inst, ldarx, stdcx); \
break;
ATOMIC_BINOP_CASE(Add, add)
ATOMIC_BINOP_CASE(Sub, sub)
......@@ -2084,17 +2071,6 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ATOMIC_BINOP_CASE(Xor, xor_)
#undef ATOMIC_BINOP_CASE
#define ATOMIC64_BINOP_CASE(op, inst) \
case kPPC_Word64Atomic##op##Uint64: \
ASSEMBLE_ATOMIC_BINOP(inst, ldarx, stdcx); \
break;
ATOMIC64_BINOP_CASE(Add, add)
ATOMIC64_BINOP_CASE(Sub, sub)
ATOMIC64_BINOP_CASE(And, and_)
ATOMIC64_BINOP_CASE(Or, orx)
ATOMIC64_BINOP_CASE(Xor, xor_)
#undef ATOMIC64_BINOP_CASE
case kPPC_ByteRev32: {
Register input = i.InputRegister(0);
Register output = i.OutputRegister();
......
This diff is collapsed.
......@@ -135,44 +135,44 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_StoreToStackSlot:
return kHasSideEffect;
case kPPC_Word64AtomicLoadUint8:
case kPPC_Word64AtomicLoadUint16:
case kPPC_Word64AtomicLoadUint32:
case kPPC_Word64AtomicLoadUint64:
case kPPC_AtomicLoadUint8:
case kPPC_AtomicLoadUint16:
case kPPC_AtomicLoadWord32:
case kPPC_AtomicLoadWord64:
return kIsLoadOperation;
case kPPC_Word64AtomicStoreUint8:
case kPPC_Word64AtomicStoreUint16:
case kPPC_Word64AtomicStoreUint32:
case kPPC_Word64AtomicStoreUint64:
case kPPC_Word64AtomicExchangeUint8:
case kPPC_Word64AtomicExchangeUint16:
case kPPC_Word64AtomicExchangeUint32:
case kPPC_Word64AtomicExchangeUint64:
case kPPC_Word64AtomicCompareExchangeUint8:
case kPPC_Word64AtomicCompareExchangeUint16:
case kPPC_Word64AtomicCompareExchangeUint32:
case kPPC_Word64AtomicCompareExchangeUint64:
case kPPC_Word64AtomicAddUint8:
case kPPC_Word64AtomicAddUint16:
case kPPC_Word64AtomicAddUint32:
case kPPC_Word64AtomicAddUint64:
case kPPC_Word64AtomicSubUint8:
case kPPC_Word64AtomicSubUint16:
case kPPC_Word64AtomicSubUint32:
case kPPC_Word64AtomicSubUint64:
case kPPC_Word64AtomicAndUint8:
case kPPC_Word64AtomicAndUint16:
case kPPC_Word64AtomicAndUint32:
case kPPC_Word64AtomicAndUint64:
case kPPC_Word64AtomicOrUint8:
case kPPC_Word64AtomicOrUint16:
case kPPC_Word64AtomicOrUint32:
case kPPC_Word64AtomicOrUint64:
case kPPC_Word64AtomicXorUint8:
case kPPC_Word64AtomicXorUint16:
case kPPC_Word64AtomicXorUint32:
case kPPC_Word64AtomicXorUint64:
case kPPC_AtomicStoreUint8:
case kPPC_AtomicStoreUint16:
case kPPC_AtomicStoreWord32:
case kPPC_AtomicStoreWord64:
case kPPC_AtomicExchangeUint8:
case kPPC_AtomicExchangeUint16:
case kPPC_AtomicExchangeWord32:
case kPPC_AtomicExchangeWord64:
case kPPC_AtomicCompareExchangeUint8:
case kPPC_AtomicCompareExchangeUint16:
case kPPC_AtomicCompareExchangeWord32:
case kPPC_AtomicCompareExchangeWord64:
case kPPC_AtomicAddUint8:
case kPPC_AtomicAddUint16:
case kPPC_AtomicAddWord32:
case kPPC_AtomicAddWord64:
case kPPC_AtomicSubUint8:
case kPPC_AtomicSubUint16:
case kPPC_AtomicSubWord32:
case kPPC_AtomicSubWord64:
case kPPC_AtomicAndUint8:
case kPPC_AtomicAndUint16:
case kPPC_AtomicAndWord32:
case kPPC_AtomicAndWord64:
case kPPC_AtomicOrUint8:
case kPPC_AtomicOrUint16:
case kPPC_AtomicOrWord32:
case kPPC_AtomicOrWord64:
case kPPC_AtomicXorUint8:
case kPPC_AtomicXorUint16:
case kPPC_AtomicXorWord32:
case kPPC_AtomicXorWord64:
return kHasSideEffect;
#define CASE(Name) case k##Name:
......
......@@ -1940,14 +1940,14 @@ void InstructionSelector::VisitWord32AtomicLoad(Node* node) {
switch (load_rep.representation()) {
case MachineRepresentation::kWord8:
opcode =
load_rep.IsSigned() ? kWord32AtomicLoadInt8 : kWord32AtomicLoadUint8;
load_rep.IsSigned() ? kWord32AtomicLoadInt8 : kPPC_AtomicLoadUint8;
break;
case MachineRepresentation::kWord16:
opcode = load_rep.IsSigned() ? kWord32AtomicLoadInt16
: kWord32AtomicLoadUint16;
opcode =
load_rep.IsSigned() ? kWord32AtomicLoadInt16 : kPPC_AtomicLoadUint16;
break;
case MachineRepresentation::kWord32:
opcode = kWord32AtomicLoadWord32;
opcode = kPPC_AtomicLoadWord32;
break;
default:
UNREACHABLE();
......@@ -1965,16 +1965,16 @@ void InstructionSelector::VisitWord64AtomicLoad(Node* node) {
ArchOpcode opcode = kArchNop;
switch (load_rep.representation()) {
case MachineRepresentation::kWord8:
opcode = kPPC_Word64AtomicLoadUint8;
opcode = kPPC_AtomicLoadUint8;
break;
case MachineRepresentation::kWord16:
opcode = kPPC_Word64AtomicLoadUint16;
opcode = kPPC_AtomicLoadUint16;
break;
case MachineRepresentation::kWord32:
opcode = kPPC_Word64AtomicLoadUint32;
opcode = kPPC_AtomicLoadWord32;
break;
case MachineRepresentation::kWord64:
opcode = kPPC_Word64AtomicLoadUint64;
opcode = kPPC_AtomicLoadWord64;
break;
default:
UNREACHABLE();
......@@ -1993,13 +1993,13 @@ void InstructionSelector::VisitWord32AtomicStore(Node* node) {
ArchOpcode opcode = kArchNop;
switch (rep) {
case MachineRepresentation::kWord8:
opcode = kWord32AtomicStoreWord8;
opcode = kPPC_AtomicStoreUint8;
break;
case MachineRepresentation::kWord16:
opcode = kWord32AtomicStoreWord16;
opcode = kPPC_AtomicStoreUint16;
break;
case MachineRepresentation::kWord32:
opcode = kWord32AtomicStoreWord32;
opcode = kPPC_AtomicStoreWord32;
break;
default:
UNREACHABLE();
......@@ -2024,16 +2024,16 @@ void InstructionSelector::VisitWord64AtomicStore(Node* node) {
ArchOpcode opcode = kArchNop;
switch (rep) {
case MachineRepresentation::kWord8:
opcode = kPPC_Word64AtomicStoreUint8;
opcode = kPPC_AtomicStoreUint8;
break;
case MachineRepresentation::kWord16:
opcode = kPPC_Word64AtomicStoreUint16;
opcode = kPPC_AtomicStoreUint16;
break;
case MachineRepresentation::kWord32:
opcode = kPPC_Word64AtomicStoreUint32;
opcode = kPPC_AtomicStoreWord32;
break;
case MachineRepresentation::kWord64:
opcode = kPPC_Word64AtomicStoreUint64;
opcode = kPPC_AtomicStoreWord64;
break;
default:
UNREACHABLE();
......@@ -2074,13 +2074,13 @@ void InstructionSelector::VisitWord32AtomicExchange(Node* node) {
if (type == MachineType::Int8()) {
opcode = kWord32AtomicExchangeInt8;
} else if (type == MachineType::Uint8()) {
opcode = kWord32AtomicExchangeUint8;
opcode = kPPC_AtomicExchangeUint8;
} else if (type == MachineType::Int16()) {
opcode = kWord32AtomicExchangeInt16;
} else if (type == MachineType::Uint16()) {
opcode = kWord32AtomicExchangeUint16;
opcode = kPPC_AtomicExchangeUint16;
} else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
opcode = kWord32AtomicExchangeWord32;
opcode = kPPC_AtomicExchangeWord32;
} else {
UNREACHABLE();
return;
......@@ -2092,13 +2092,13 @@ void InstructionSelector::VisitWord64AtomicExchange(Node* node) {
ArchOpcode opcode = kArchNop;
MachineType type = AtomicOpType(node->op());
if (type == MachineType::Uint8()) {
opcode = kPPC_Word64AtomicExchangeUint8;
opcode = kPPC_AtomicExchangeUint8;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_Word64AtomicExchangeUint16;
opcode = kPPC_AtomicExchangeUint16;
} else if (type == MachineType::Uint32()) {
opcode = kPPC_Word64AtomicExchangeUint32;
opcode = kPPC_AtomicExchangeWord32;
} else if (type == MachineType::Uint64()) {
opcode = kPPC_Word64AtomicExchangeUint64;
opcode = kPPC_AtomicExchangeWord64;
} else {
UNREACHABLE();
return;
......@@ -2137,13 +2137,13 @@ void InstructionSelector::VisitWord32AtomicCompareExchange(Node* node) {
if (type == MachineType::Int8()) {
opcode = kWord32AtomicCompareExchangeInt8;
} else if (type == MachineType::Uint8()) {
opcode = kWord32AtomicCompareExchangeUint8;
opcode = kPPC_AtomicCompareExchangeUint8;
} else if (type == MachineType::Int16()) {
opcode = kWord32AtomicCompareExchangeInt16;
} else if (type == MachineType::Uint16()) {
opcode = kWord32AtomicCompareExchangeUint16;
opcode = kPPC_AtomicCompareExchangeUint16;
} else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
opcode = kWord32AtomicCompareExchangeWord32;
opcode = kPPC_AtomicCompareExchangeWord32;
} else {
UNREACHABLE();
return;
......@@ -2155,13 +2155,13 @@ void InstructionSelector::VisitWord64AtomicCompareExchange(Node* node) {
MachineType type = AtomicOpType(node->op());
ArchOpcode opcode = kArchNop;
if (type == MachineType::Uint8()) {
opcode = kPPC_Word64AtomicCompareExchangeUint8;
opcode = kPPC_AtomicCompareExchangeUint8;
} else if (type == MachineType::Uint16()) {
opcode = kPPC_Word64AtomicCompareExchangeUint16;
opcode = kPPC_AtomicCompareExchangeUint16;
} else if (type == MachineType::Uint32()) {
opcode = kPPC_Word64AtomicCompareExchangeUint32;
opcode = kPPC_AtomicCompareExchangeWord32;
} else if (type == MachineType::Uint64()) {
opcode = kPPC_Word64AtomicCompareExchangeUint64;
opcode = kPPC_AtomicCompareExchangeWord64;
} else {
UNREACHABLE();
return;
......@@ -2215,12 +2215,12 @@ void InstructionSelector::VisitWord32AtomicBinaryOperation(
VisitAtomicBinaryOperation(this, node, opcode);
}
#define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kWord32Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kWord32Atomic##op##Uint16, \
kWord32Atomic##op##Word32); \
#define VISIT_ATOMIC_BINOP(op) \
void InstructionSelector::VisitWord32Atomic##op(Node* node) { \
VisitWord32AtomicBinaryOperation( \
node, kWord32Atomic##op##Int8, kPPC_Atomic##op##Uint8, \
kWord32Atomic##op##Int16, kPPC_Atomic##op##Uint16, \
kPPC_Atomic##op##Word32); \
}
VISIT_ATOMIC_BINOP(Add)
VISIT_ATOMIC_BINOP(Sub)
......@@ -2234,7 +2234,6 @@ void InstructionSelector::VisitWord64AtomicBinaryOperation(
ArchOpcode uint64_op) {
MachineType type = AtomicOpType(node->op());
ArchOpcode opcode = kArchNop;
if (type == MachineType::Uint8()) {
opcode = uint8_op;
} else if (type == MachineType::Uint16()) {
......@@ -2250,11 +2249,11 @@ void InstructionSelector::VisitWord64AtomicBinaryOperation(
VisitAtomicBinaryOperation(this, node, opcode);
}
#define VISIT_ATOMIC64_BINOP(op) \
void InstructionSelector::VisitWord64Atomic##op(Node* node) { \
VisitWord64AtomicBinaryOperation( \
node, kPPC_Word64Atomic##op##Uint8, kPPC_Word64Atomic##op##Uint16, \
kPPC_Word64Atomic##op##Uint32, kPPC_Word64Atomic##op##Uint64); \
#define VISIT_ATOMIC64_BINOP(op) \
void InstructionSelector::VisitWord64Atomic##op(Node* node) { \
VisitWord64AtomicBinaryOperation( \
node, kPPC_Atomic##op##Uint8, kPPC_Atomic##op##Uint16, \
kPPC_Atomic##op##Word32, kPPC_Atomic##op##Word64); \
}
VISIT_ATOMIC64_BINOP(Add)
VISIT_ATOMIC64_BINOP(Sub)
......
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