Commit a0c59cbf authored by sreten.kovacevic's avatar sreten.kovacevic Committed by Commit Bot

[mipsr6] Implement functions for FPU conditional move

Since movf and movt instructions were removed in r6, sel_s and
sel_d instructions need to be used instead with some preparations.

Change-Id: Ia6a2fda7d3d79ada1ae1ec4649793efd2466f79b
Reviewed-on: https://chromium-review.googlesource.com/1016910Reviewed-by: 's avatarIvica Bogosavljevic <ivica.bogosavljevic@mips.com>
Commit-Queue: Sreten Kovacevic <sreten.kovacevic@mips.com>
Cr-Commit-Position: refs/heads/master@{#52683}
parent 9da5e9ab
......@@ -2406,6 +2406,24 @@ void TurboAssembler::LoadZeroIfConditionZero(Register dest,
}
}
void TurboAssembler::LoadZeroIfFPUCondition(Register dest) {
if (IsMipsArchVariant(kMips32r6)) {
mfc1(kScratchReg, kDoubleCompareReg);
LoadZeroIfConditionNotZero(dest, kScratchReg);
} else {
Movt(dest, zero_reg);
}
}
void TurboAssembler::LoadZeroIfNotFPUCondition(Register dest) {
if (IsMipsArchVariant(kMips32r6)) {
mfc1(kScratchReg, kDoubleCompareReg);
LoadZeroIfConditionZero(dest, kScratchReg);
} else {
Movf(dest, zero_reg);
}
}
void TurboAssembler::Movz(Register rd, Register rs, Register rt) {
if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) {
Label done;
......
......@@ -568,6 +568,9 @@ class TurboAssembler : public Assembler {
void Movt(Register rd, Register rs, uint16_t cc = 0);
void Movf(Register rd, Register rs, uint16_t cc = 0);
void LoadZeroIfFPUCondition(Register dest);
void LoadZeroIfNotFPUCondition(Register dest);
void LoadZeroIfConditionNotZero(Register dest, Register condition);
void LoadZeroIfConditionZero(Register dest, Register condition);
void LoadZeroOnCondition(Register rd, Register rs, const Operand& rt,
......
......@@ -2942,6 +2942,24 @@ void TurboAssembler::LoadZeroIfConditionZero(Register dest,
}
}
void TurboAssembler::LoadZeroIfFPUCondition(Register dest) {
if (kArchVariant == kMips64r6) {
dmfc1(kScratchReg, kDoubleCompareReg);
LoadZeroIfConditionNotZero(dest, kScratchReg);
} else {
Movt(dest, zero_reg);
}
}
void TurboAssembler::LoadZeroIfNotFPUCondition(Register dest) {
if (kArchVariant == kMips64r6) {
dmfc1(kScratchReg, kDoubleCompareReg);
LoadZeroIfConditionZero(dest, kScratchReg);
} else {
Movf(dest, zero_reg);
}
}
void TurboAssembler::Movt(Register rd, Register rs, uint16_t cc) {
movt(rd, rs, cc);
}
......
......@@ -599,6 +599,9 @@ class TurboAssembler : public Assembler {
void Movt(Register rd, Register rs, uint16_t cc = 0);
void Movf(Register rd, Register rs, uint16_t cc = 0);
void LoadZeroIfFPUCondition(Register dest);
void LoadZeroIfNotFPUCondition(Register dest);
void LoadZeroIfConditionNotZero(Register dest, Register condition);
void LoadZeroIfConditionZero(Register dest, Register condition);
void LoadZeroOnCondition(Register rd, Register rs, const Operand& rt,
......
......@@ -962,9 +962,9 @@ void LiftoffAssembler::emit_f32_set_cond(Condition cond, Register dst,
FPUCondition fcond = liftoff::ConditionToConditionCmpFPU(predicate, cond);
TurboAssembler::CompareF32(fcond, lhs, rhs);
if (predicate) {
TurboAssembler::Movf(dst, zero_reg);
TurboAssembler::LoadZeroIfNotFPUCondition(dst);
} else {
TurboAssembler::Movt(dst, zero_reg);
TurboAssembler::LoadZeroIfFPUCondition(dst);
}
bind(&cont);
......@@ -991,9 +991,9 @@ void LiftoffAssembler::emit_f64_set_cond(Condition cond, Register dst,
FPUCondition fcond = liftoff::ConditionToConditionCmpFPU(predicate, cond);
TurboAssembler::CompareF64(fcond, lhs, rhs);
if (predicate) {
TurboAssembler::Movf(dst, zero_reg);
TurboAssembler::LoadZeroIfNotFPUCondition(dst);
} else {
TurboAssembler::Movt(dst, zero_reg);
TurboAssembler::LoadZeroIfFPUCondition(dst);
}
bind(&cont);
......
......@@ -755,9 +755,9 @@ void LiftoffAssembler::emit_f32_set_cond(Condition cond, Register dst,
FPUCondition fcond = liftoff::ConditionToConditionCmpFPU(predicate, cond);
TurboAssembler::CompareF32(fcond, lhs, rhs);
if (predicate) {
TurboAssembler::Movf(dst, zero_reg);
TurboAssembler::LoadZeroIfNotFPUCondition(dst);
} else {
TurboAssembler::Movt(dst, zero_reg);
TurboAssembler::LoadZeroIfFPUCondition(dst);
}
bind(&cont);
......@@ -784,9 +784,9 @@ void LiftoffAssembler::emit_f64_set_cond(Condition cond, Register dst,
FPUCondition fcond = liftoff::ConditionToConditionCmpFPU(predicate, cond);
TurboAssembler::CompareF64(fcond, lhs, rhs);
if (predicate) {
TurboAssembler::Movf(dst, zero_reg);
TurboAssembler::LoadZeroIfNotFPUCondition(dst);
} else {
TurboAssembler::Movt(dst, zero_reg);
TurboAssembler::LoadZeroIfFPUCondition(dst);
}
bind(&cont);
......
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