Commit e7d521fb authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC64: [turbofan] Word32 loads should be unsigned.

TEST=cctest/test-run-load-store/*
R=joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, bjaideep@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1910123002

Cr-Commit-Position: refs/heads/master@{#35733}
parent 8e03bdef
...@@ -259,15 +259,10 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -259,15 +259,10 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
case kPPC_Add: case kPPC_Add:
case kPPC_Sub: case kPPC_Sub:
return lt;
#endif #endif
case kPPC_AddWithOverflow32: case kPPC_AddWithOverflow32:
case kPPC_SubWithOverflow32: case kPPC_SubWithOverflow32:
#if V8_TARGET_ARCH_PPC64
return ne;
#else
return lt; return lt;
#endif
default: default:
break; break;
} }
...@@ -277,15 +272,10 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -277,15 +272,10 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
case kPPC_Add: case kPPC_Add:
case kPPC_Sub: case kPPC_Sub:
return ge;
#endif #endif
case kPPC_AddWithOverflow32: case kPPC_AddWithOverflow32:
case kPPC_SubWithOverflow32: case kPPC_SubWithOverflow32:
#if V8_TARGET_ARCH_PPC64
return eq;
#else
return ge; return ge;
#endif
default: default:
break; break;
} }
...@@ -378,17 +368,16 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -378,17 +368,16 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
#define ASSEMBLE_ADD_WITH_OVERFLOW32() \ #define ASSEMBLE_ADD_WITH_OVERFLOW32() \
do { \ do { \
ASSEMBLE_BINOP(add, addi); \ ASSEMBLE_ADD_WITH_OVERFLOW(); \
__ TestIfInt32(i.OutputRegister(), r0, cr0); \ __ extsw(kScratchReg, kScratchReg, SetRC); \
} while (0) } while (0)
#define ASSEMBLE_SUB_WITH_OVERFLOW32() \
#define ASSEMBLE_SUB_WITH_OVERFLOW32() \ do { \
do { \ ASSEMBLE_SUB_WITH_OVERFLOW(); \
ASSEMBLE_BINOP(sub, subi); \ __ extsw(kScratchReg, kScratchReg, SetRC); \
__ TestIfInt32(i.OutputRegister(), r0, cr0); \
} while (0) } while (0)
#else #else
#define ASSEMBLE_ADD_WITH_OVERFLOW32 ASSEMBLE_ADD_WITH_OVERFLOW #define ASSEMBLE_ADD_WITH_OVERFLOW32 ASSEMBLE_ADD_WITH_OVERFLOW
...@@ -537,7 +526,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -537,7 +526,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
} while (0) } while (0)
// TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, asm_instrx, width) \ #define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, asm_instrx, width) \
do { \ do { \
DoubleRegister result = i.OutputDoubleRegister(); \ DoubleRegister result = i.OutputDoubleRegister(); \
...@@ -546,7 +534,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -546,7 +534,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
MemOperand operand = i.MemoryOperand(&mode, index); \ MemOperand operand = i.MemoryOperand(&mode, index); \
DCHECK_EQ(kMode_MRR, mode); \ DCHECK_EQ(kMode_MRR, mode); \
Register offset = operand.rb(); \ Register offset = operand.rb(); \
__ extsw(offset, offset); \
if (HasRegisterInput(instr, 2)) { \ if (HasRegisterInput(instr, 2)) { \
__ cmplw(offset, i.InputRegister(2)); \ __ cmplw(offset, i.InputRegister(2)); \
} else { \ } else { \
...@@ -564,7 +551,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -564,7 +551,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
} while (0) } while (0)
// TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
#define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr, asm_instrx) \ #define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr, asm_instrx) \
do { \ do { \
Register result = i.OutputRegister(); \ Register result = i.OutputRegister(); \
...@@ -573,7 +559,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -573,7 +559,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
MemOperand operand = i.MemoryOperand(&mode, index); \ MemOperand operand = i.MemoryOperand(&mode, index); \
DCHECK_EQ(kMode_MRR, mode); \ DCHECK_EQ(kMode_MRR, mode); \
Register offset = operand.rb(); \ Register offset = operand.rb(); \
__ extsw(offset, offset); \
if (HasRegisterInput(instr, 2)) { \ if (HasRegisterInput(instr, 2)) { \
__ cmplw(offset, i.InputRegister(2)); \ __ cmplw(offset, i.InputRegister(2)); \
} else { \ } else { \
...@@ -591,7 +576,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -591,7 +576,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
} while (0) } while (0)
// TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
#define ASSEMBLE_CHECKED_STORE_FLOAT32() \ #define ASSEMBLE_CHECKED_STORE_FLOAT32() \
do { \ do { \
Label done; \ Label done; \
...@@ -600,7 +584,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -600,7 +584,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
MemOperand operand = i.MemoryOperand(&mode, index); \ MemOperand operand = i.MemoryOperand(&mode, index); \
DCHECK_EQ(kMode_MRR, mode); \ DCHECK_EQ(kMode_MRR, mode); \
Register offset = operand.rb(); \ Register offset = operand.rb(); \
__ extsw(offset, offset); \
if (HasRegisterInput(instr, 2)) { \ if (HasRegisterInput(instr, 2)) { \
__ cmplw(offset, i.InputRegister(2)); \ __ cmplw(offset, i.InputRegister(2)); \
} else { \ } else { \
...@@ -619,7 +602,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -619,7 +602,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
} while (0) } while (0)
// TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
#define ASSEMBLE_CHECKED_STORE_DOUBLE() \ #define ASSEMBLE_CHECKED_STORE_DOUBLE() \
do { \ do { \
Label done; \ Label done; \
...@@ -628,7 +610,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -628,7 +610,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
MemOperand operand = i.MemoryOperand(&mode, index); \ MemOperand operand = i.MemoryOperand(&mode, index); \
DCHECK_EQ(kMode_MRR, mode); \ DCHECK_EQ(kMode_MRR, mode); \
Register offset = operand.rb(); \ Register offset = operand.rb(); \
__ extsw(offset, offset); \
if (HasRegisterInput(instr, 2)) { \ if (HasRegisterInput(instr, 2)) { \
__ cmplw(offset, i.InputRegister(2)); \ __ cmplw(offset, i.InputRegister(2)); \
} else { \ } else { \
...@@ -646,7 +627,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -646,7 +627,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
} while (0) } while (0)
// TODO(mbrandy): fix paths that produce garbage in offset's upper 32-bits.
#define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr, asm_instrx) \ #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr, asm_instrx) \
do { \ do { \
Label done; \ Label done; \
...@@ -655,7 +635,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) { ...@@ -655,7 +635,6 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
MemOperand operand = i.MemoryOperand(&mode, index); \ MemOperand operand = i.MemoryOperand(&mode, index); \
DCHECK_EQ(kMode_MRR, mode); \ DCHECK_EQ(kMode_MRR, mode); \
Register offset = operand.rb(); \ Register offset = operand.rb(); \
__ extsw(offset, offset); \
if (HasRegisterInput(instr, 2)) { \ if (HasRegisterInput(instr, 2)) { \
__ cmplw(offset, i.InputRegister(2)); \ __ cmplw(offset, i.InputRegister(2)); \
} else { \ } else { \
...@@ -1516,6 +1495,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -1516,6 +1495,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
case kPPC_LoadWordS16: case kPPC_LoadWordS16:
ASSEMBLE_LOAD_INTEGER(lha, lhax); ASSEMBLE_LOAD_INTEGER(lha, lhax);
break; break;
case kPPC_LoadWordU32:
ASSEMBLE_LOAD_INTEGER(lwz, lwzx);
break;
case kPPC_LoadWordS32: case kPPC_LoadWordS32:
ASSEMBLE_LOAD_INTEGER(lwa, lwax); ASSEMBLE_LOAD_INTEGER(lwa, lwax);
break; break;
...@@ -1564,7 +1546,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -1564,7 +1546,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
ASSEMBLE_CHECKED_LOAD_INTEGER(lhz, lhzx); ASSEMBLE_CHECKED_LOAD_INTEGER(lhz, lhzx);
break; break;
case kCheckedLoadWord32: case kCheckedLoadWord32:
ASSEMBLE_CHECKED_LOAD_INTEGER(lwa, lwax); ASSEMBLE_CHECKED_LOAD_INTEGER(lwz, lwzx);
break; break;
case kCheckedLoadWord64: case kCheckedLoadWord64:
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
...@@ -1616,7 +1598,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -1616,7 +1598,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
ASSEMBLE_ATOMIC_LOAD_INTEGER(lhz, lhzx); ASSEMBLE_ATOMIC_LOAD_INTEGER(lhz, lhzx);
break; break;
case kAtomicLoadWord32: case kAtomicLoadWord32:
ASSEMBLE_ATOMIC_LOAD_INTEGER(lwa, lwax); ASSEMBLE_ATOMIC_LOAD_INTEGER(lwz, lwzx);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1717,7 +1699,7 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { ...@@ -1717,7 +1699,7 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) {
PPCOperandConverter i(this, instr); PPCOperandConverter i(this, instr);
Register input = i.InputRegister(0); Register input = i.InputRegister(0);
for (size_t index = 2; index < instr->InputCount(); index += 2) { for (size_t index = 2; index < instr->InputCount(); index += 2) {
__ Cmpi(input, Operand(i.InputInt32(index + 0)), r0); __ Cmpwi(input, Operand(i.InputInt32(index + 0)), r0);
__ beq(GetLabel(i.InputRpo(index + 1))); __ beq(GetLabel(i.InputRpo(index + 1)));
} }
AssembleArchJump(i.InputRpo(1)); AssembleArchJump(i.InputRpo(1));
......
...@@ -112,6 +112,7 @@ namespace compiler { ...@@ -112,6 +112,7 @@ namespace compiler {
V(PPC_LoadWordS16) \ V(PPC_LoadWordS16) \
V(PPC_LoadWordU16) \ V(PPC_LoadWordU16) \
V(PPC_LoadWordS32) \ V(PPC_LoadWordS32) \
V(PPC_LoadWordU32) \
V(PPC_LoadWord64) \ V(PPC_LoadWord64) \
V(PPC_LoadFloat32) \ V(PPC_LoadFloat32) \
V(PPC_LoadDouble) \ V(PPC_LoadDouble) \
......
...@@ -113,6 +113,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -113,6 +113,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_LoadWordS16: case kPPC_LoadWordS16:
case kPPC_LoadWordU16: case kPPC_LoadWordU16:
case kPPC_LoadWordS32: case kPPC_LoadWordS32:
case kPPC_LoadWordU32:
case kPPC_LoadWord64: case kPPC_LoadWord64:
case kPPC_LoadFloat32: case kPPC_LoadFloat32:
case kPPC_LoadDouble: case kPPC_LoadDouble:
......
...@@ -190,11 +190,7 @@ void InstructionSelector::VisitLoad(Node* node) { ...@@ -190,11 +190,7 @@ void InstructionSelector::VisitLoad(Node* node) {
case MachineRepresentation::kTagged: // Fall through. case MachineRepresentation::kTagged: // Fall through.
#endif #endif
case MachineRepresentation::kWord32: case MachineRepresentation::kWord32:
opcode = kPPC_LoadWordS32; opcode = kPPC_LoadWordU32;
#if V8_TARGET_ARCH_PPC64
// TODO(mbrandy): this applies to signed loads only (lwa)
mode = kInt16Imm_4ByteAligned;
#endif
break; break;
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
case MachineRepresentation::kTagged: // Fall through. case MachineRepresentation::kTagged: // Fall through.
......
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