Commit f86b1532 authored by Predrag Rudic's avatar Predrag Rudic Committed by Commit Bot

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/1078755Reviewed-by: 's avatarIvica Bogosavljevic <ivica.bogosavljevic@mips.com>
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Cr-Commit-Position: refs/heads/master@{#53455}
parent 1a95fbcd
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/compiler/node-matchers.h" #include "src/compiler/node-matchers.h"
#include "src/compiler/osr.h" #include "src/compiler/osr.h"
#include "src/heap/heap-inl.h" #include "src/heap/heap-inl.h"
#include "src/mips64/constants-mips64.h"
#include "src/mips64/macro-assembler-mips64.h" #include "src/mips64/macro-assembler-mips64.h"
#include "src/optimized-compilation-info.h" #include "src/optimized-compilation-info.h"
...@@ -1786,7 +1787,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1786,7 +1787,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ldc1(i.OutputDoubleRegister(), MemOperand(fp, offset)); __ Ldc1(i.OutputDoubleRegister(), MemOperand(fp, offset));
} else { } else {
DCHECK_EQ(op->representation(), MachineRepresentation::kFloat32); DCHECK_EQ(op->representation(), MachineRepresentation::kFloat32);
__ lwc1(i.OutputSingleRegister(0), MemOperand(fp, offset)); __ lwc1(
i.OutputSingleRegister(0),
MemOperand(fp, offset + kLessSignificantWordInDoublewordOffset));
} }
} else { } else {
__ Ld(i.OutputRegister(0), MemOperand(fp, offset)); __ Ld(i.OutputRegister(0), MemOperand(fp, offset));
...@@ -3634,10 +3637,10 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, ...@@ -3634,10 +3637,10 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
if (destination->IsFPStackSlot()) { if (destination->IsFPStackSlot()) {
MemOperand dst = g.ToMemOperand(destination); MemOperand dst = g.ToMemOperand(destination);
if (bit_cast<int32_t>(src.ToFloat32()) == 0) { if (bit_cast<int32_t>(src.ToFloat32()) == 0) {
__ Sw(zero_reg, dst); __ Sd(zero_reg, dst);
} else { } else {
__ li(kScratchReg, Operand(bit_cast<int32_t>(src.ToFloat32()))); __ li(kScratchReg, Operand(bit_cast<int32_t>(src.ToFloat32())));
__ Sw(kScratchReg, dst); __ Sd(kScratchReg, dst);
} }
} else { } else {
DCHECK(destination->IsFPRegister()); DCHECK(destination->IsFPRegister());
......
...@@ -84,8 +84,10 @@ const uint32_t kMipsSdlOffset = 0; ...@@ -84,8 +84,10 @@ const uint32_t kMipsSdlOffset = 0;
#if defined(V8_TARGET_LITTLE_ENDIAN) #if defined(V8_TARGET_LITTLE_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 0; const uint32_t kLeastSignificantByteInInt32Offset = 0;
const uint32_t kLessSignificantWordInDoublewordOffset = 0;
#elif defined(V8_TARGET_BIG_ENDIAN) #elif defined(V8_TARGET_BIG_ENDIAN)
const uint32_t kLeastSignificantByteInInt32Offset = 3; const uint32_t kLeastSignificantByteInInt32Offset = 3;
const uint32_t kLessSignificantWordInDoublewordOffset = 4;
#else #else
#error Unknown endianness #error Unknown endianness
#endif #endif
......
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