Commit 108d5264 authored by ivica.bogosavljevic's avatar ivica.bogosavljevic Committed by Commit bot

MIPS: Fix uninitialized upper word bits for Cvt_d_uw macro.

After Cvt_d_uw macro, upper 32 bits of the output remain
unitnitialized which caused flaky failures on some tests on
MIPS32R6

TEST=cctest/test-assembler-mips/MIPS13,mjsunit/asm/int32-umod
BUG=

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

Cr-Commit-Position: refs/heads/master@{#32983}
parent c0c8c756
......@@ -1270,6 +1270,7 @@ void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs,
// In FP64Mode we do convertion from long.
if (IsFp64Mode()) {
mtc1(rs, scratch);
Mthc1(zero_reg, scratch);
cvt_d_l(fd, scratch);
} else {
// Convert rs to a FP value in fd.
......
......@@ -1819,48 +1819,46 @@ TEST(rint_s) {
TEST(Cvt_d_uw) {
if (IsMipsArchVariant(kMips32r2)) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
MacroAssembler assm(isolate, NULL, 0,
v8::internal::CodeObjectRequired::kYes);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
MacroAssembler assm(isolate, NULL, 0,
v8::internal::CodeObjectRequired::kYes);
typedef struct test_struct {
unsigned input;
uint64_t output;
} TestStruct;
typedef struct test_struct {
unsigned input;
uint64_t output;
} TestStruct;
unsigned inputs[] = {
0x0, 0xffffffff, 0x80000000, 0x7fffffff
};
unsigned inputs[] = {
0x0, 0xffffffff, 0x80000000, 0x7fffffff
};
uint64_t outputs[] = {
0x0, 0x41efffffffe00000,
0x41e0000000000000, 0x41dfffffffc00000
};
uint64_t outputs[] = {
0x0, 0x41efffffffe00000,
0x41e0000000000000, 0x41dfffffffc00000
};
int kTableLength = sizeof(inputs)/sizeof(inputs[0]);
int kTableLength = sizeof(inputs)/sizeof(inputs[0]);
TestStruct test;
TestStruct test;
__ lw(t1, MemOperand(a0, offsetof(TestStruct, input)));
__ Cvt_d_uw(f4, t1, f6);
__ sdc1(f4, MemOperand(a0, offsetof(TestStruct, output)));
__ jr(ra);
__ nop();
__ lw(t1, MemOperand(a0, offsetof(TestStruct, input)));
__ Cvt_d_uw(f4, t1, f6);
__ sdc1(f4, MemOperand(a0, offsetof(TestStruct, output)));
__ jr(ra);
__ nop();
CodeDesc desc;
assm.GetCode(&desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < kTableLength; i++) {
test.input = inputs[i];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
// Check outputs
CHECK_EQ(test.output, outputs[i]);
}
CodeDesc desc;
assm.GetCode(&desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
F3 f = FUNCTION_CAST<F3>(code->entry());
for (int i = 0; i < kTableLength; i++) {
test.input = inputs[i];
(CALL_GENERATED_CODE(isolate, f, &test, 0, 0, 0, 0));
// Check outputs
CHECK_EQ(test.output, outputs[i]);
}
}
......
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