MIPS64 Fix load and store of float32 constant from/to stack

Tests that pointed out error are
cctest/test-code-generator/FuzzAssembleMove and
cctest/test-multiple-return/ReturnLastValueFloat32
on big endian architecture.

Change-Id: I47eb5d3b3aeffef4531f7961e94c0ccd7dece191
Reviewed-on: https://chromium-review.googlesource.com/1078755
Reviewed-by: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Cr-Commit-Position: refs/heads/master@{#53455}
This commit is contained in:
Predrag Rudic 2018-05-31 10:04:49 +02:00 committed by Commit Bot
parent 1a95fbcda3
commit f86b153278
2 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@
#include "src/compiler/node-matchers.h"
#include "src/compiler/osr.h"
#include "src/heap/heap-inl.h"
#include "src/mips64/constants-mips64.h"
#include "src/mips64/macro-assembler-mips64.h"
#include "src/optimized-compilation-info.h"
@ -1786,7 +1787,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ldc1(i.OutputDoubleRegister(), MemOperand(fp, offset));
} else {
DCHECK_EQ(op->representation(), MachineRepresentation::kFloat32);
__ lwc1(i.OutputSingleRegister(0), MemOperand(fp, offset));
__ lwc1(
i.OutputSingleRegister(0),
MemOperand(fp, offset + kLessSignificantWordInDoublewordOffset));
}
} else {
__ Ld(i.OutputRegister(0), MemOperand(fp, offset));
@ -3634,10 +3637,10 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
if (destination->IsFPStackSlot()) {
MemOperand dst = g.ToMemOperand(destination);
if (bit_cast<int32_t>(src.ToFloat32()) == 0) {
__ Sw(zero_reg, dst);
__ Sd(zero_reg, dst);
} else {
__ li(kScratchReg, Operand(bit_cast<int32_t>(src.ToFloat32())));
__ Sw(kScratchReg, dst);
__ Sd(kScratchReg, dst);
}
} else {
DCHECK(destination->IsFPRegister());

View File

@ -84,8 +84,10 @@ const uint32_t kMipsSdlOffset = 0;
#if defined(V8_TARGET_LITTLE_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 0;
const uint32_t kLessSignificantWordInDoublewordOffset = 0;
#elif defined(V8_TARGET_BIG_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 3;
const uint32_t kLessSignificantWordInDoublewordOffset = 4;
#else
#error Unknown endianness
#endif