Commit 7551eca9 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS64: Fix [turbofan] Length and index2 are unsigned in CheckedLoad/CheckedStore.

Port b994ad45

Original commit message:
Also factor out test cases from test-run-machops.cc into test-run-load-store.cc

TEST=cctest/test-run-load-store/RunLoadStoreZeroExtend64, cctest/test-run-load-store/RunOobCheckedLoadT_pseudo7, cctest/test-run-load-store/RunOobCheckedLoad_pseudo7
BUG=chromium:599717
LOG=Y

Review-Url: https://codereview.chromium.org/1907363002
Cr-Commit-Position: refs/heads/master@{#36017}
parent e93f06ad
...@@ -359,7 +359,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -359,7 +359,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
} // namespace } // namespace
#define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \ #define ASSEMBLE_CHECKED_LOAD_FLOAT(width, asm_instr) \
do { \ do { \
auto result = i.Output##width##Register(); \ auto result = i.Output##width##Register(); \
...@@ -367,7 +366,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -367,7 +366,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
if (instr->InputAt(0)->IsRegister()) { \ if (instr->InputAt(0)->IsRegister()) { \
auto offset = i.InputRegister(0); \ auto offset = i.InputRegister(0); \
__ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \
__ Daddu(kScratchReg, i.InputRegister(2), offset); \ __ And(kScratchReg, offset, Operand(0xffffffff)); \
__ Daddu(kScratchReg, i.InputRegister(2), kScratchReg); \
__ asm_instr(result, MemOperand(kScratchReg, 0)); \ __ asm_instr(result, MemOperand(kScratchReg, 0)); \
} else { \ } else { \
int offset = static_cast<int>(i.InputOperand(0).immediate()); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
...@@ -377,7 +377,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -377,7 +377,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
__ bind(ool->exit()); \ __ bind(ool->exit()); \
} while (0) } while (0)
#define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \ #define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \
do { \ do { \
auto result = i.OutputRegister(); \ auto result = i.OutputRegister(); \
...@@ -385,7 +384,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -385,7 +384,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
if (instr->InputAt(0)->IsRegister()) { \ if (instr->InputAt(0)->IsRegister()) { \
auto offset = i.InputRegister(0); \ auto offset = i.InputRegister(0); \
__ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \ __ Branch(USE_DELAY_SLOT, ool->entry(), hs, offset, i.InputOperand(1)); \
__ Daddu(kScratchReg, i.InputRegister(2), offset); \ __ And(kScratchReg, offset, Operand(0xffffffff)); \
__ Daddu(kScratchReg, i.InputRegister(2), kScratchReg); \
__ asm_instr(result, MemOperand(kScratchReg, 0)); \ __ asm_instr(result, MemOperand(kScratchReg, 0)); \
} else { \ } else { \
int offset = static_cast<int>(i.InputOperand(0).immediate()); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
...@@ -395,7 +395,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -395,7 +395,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
__ bind(ool->exit()); \ __ bind(ool->exit()); \
} while (0) } while (0)
#define ASSEMBLE_CHECKED_STORE_FLOAT(width, asm_instr) \ #define ASSEMBLE_CHECKED_STORE_FLOAT(width, asm_instr) \
do { \ do { \
Label done; \ Label done; \
...@@ -403,7 +402,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -403,7 +402,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
auto offset = i.InputRegister(0); \ auto offset = i.InputRegister(0); \
auto value = i.Input##width##Register(2); \ auto value = i.Input##width##Register(2); \
__ Branch(USE_DELAY_SLOT, &done, hs, offset, i.InputOperand(1)); \ __ Branch(USE_DELAY_SLOT, &done, hs, offset, i.InputOperand(1)); \
__ Daddu(kScratchReg, i.InputRegister(3), offset); \ __ And(kScratchReg, offset, Operand(0xffffffff)); \
__ Daddu(kScratchReg, i.InputRegister(3), kScratchReg); \
__ asm_instr(value, MemOperand(kScratchReg, 0)); \ __ asm_instr(value, MemOperand(kScratchReg, 0)); \
} else { \ } else { \
int offset = static_cast<int>(i.InputOperand(0).immediate()); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
...@@ -414,7 +414,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -414,7 +414,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
__ bind(&done); \ __ bind(&done); \
} while (0) } while (0)
#define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr) \ #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr) \
do { \ do { \
Label done; \ Label done; \
...@@ -422,7 +421,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -422,7 +421,8 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
auto offset = i.InputRegister(0); \ auto offset = i.InputRegister(0); \
auto value = i.InputRegister(2); \ auto value = i.InputRegister(2); \
__ Branch(USE_DELAY_SLOT, &done, hs, offset, i.InputOperand(1)); \ __ Branch(USE_DELAY_SLOT, &done, hs, offset, i.InputOperand(1)); \
__ Daddu(kScratchReg, i.InputRegister(3), offset); \ __ And(kScratchReg, offset, Operand(0xffffffff)); \
__ Daddu(kScratchReg, i.InputRegister(3), kScratchReg); \
__ asm_instr(value, MemOperand(kScratchReg, 0)); \ __ asm_instr(value, MemOperand(kScratchReg, 0)); \
} else { \ } else { \
int offset = static_cast<int>(i.InputOperand(0).immediate()); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
...@@ -433,7 +433,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, ...@@ -433,7 +433,6 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate,
__ bind(&done); \ __ bind(&done); \
} while (0) } while (0)
#define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(mode) \ #define ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(mode) \
if (kArchVariant == kMips64r6) { \ if (kArchVariant == kMips64r6) { \
__ cfc1(kScratchReg, FCSR); \ __ cfc1(kScratchReg, FCSR); \
...@@ -1491,6 +1490,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1491,6 +1490,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kMips64Lw: case kMips64Lw:
__ lw(i.OutputRegister(), i.MemoryOperand()); __ lw(i.OutputRegister(), i.MemoryOperand());
break; break;
case kMips64Lwu:
__ lwu(i.OutputRegister(), i.MemoryOperand());
break;
case kMips64Ld: case kMips64Ld:
__ ld(i.OutputRegister(), i.MemoryOperand()); __ ld(i.OutputRegister(), i.MemoryOperand());
break; break;
......
...@@ -116,9 +116,10 @@ namespace compiler { ...@@ -116,9 +116,10 @@ namespace compiler {
V(Mips64Lh) \ V(Mips64Lh) \
V(Mips64Lhu) \ V(Mips64Lhu) \
V(Mips64Sh) \ V(Mips64Sh) \
V(Mips64Ld) \
V(Mips64Lw) \ V(Mips64Lw) \
V(Mips64Lwu) \
V(Mips64Sw) \ V(Mips64Sw) \
V(Mips64Ld) \
V(Mips64Sd) \ V(Mips64Sd) \
V(Mips64Lwc1) \ V(Mips64Lwc1) \
V(Mips64Swc1) \ V(Mips64Swc1) \
......
...@@ -158,7 +158,7 @@ void InstructionSelector::VisitLoad(Node* node) { ...@@ -158,7 +158,7 @@ void InstructionSelector::VisitLoad(Node* node) {
opcode = load_rep.IsUnsigned() ? kMips64Lhu : kMips64Lh; opcode = load_rep.IsUnsigned() ? kMips64Lhu : kMips64Lh;
break; break;
case MachineRepresentation::kWord32: case MachineRepresentation::kWord32:
opcode = kMips64Lw; opcode = load_rep.IsUnsigned() ? kMips64Lwu : kMips64Lw;
break; break;
case MachineRepresentation::kTagged: // Fall through. case MachineRepresentation::kTagged: // Fall through.
case MachineRepresentation::kWord64: case MachineRepresentation::kWord64:
......
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