common/fp/op/FPRSqrtStepFused: Add half-precision specialization for FPRSqrtStepFused
This commit is contained in:
parent
45864133f5
commit
e3b2eb57b5
1 changed files with 6 additions and 5 deletions
|
@ -19,8 +19,8 @@ template<typename FPT>
|
||||||
FPT FPRSqrtStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
|
FPT FPRSqrtStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
|
||||||
op1 = FPNeg(op1);
|
op1 = FPNeg(op1);
|
||||||
|
|
||||||
const auto [type1, sign1, value1] = FPUnpack<FPT>(op1, fpcr, fpsr);
|
const auto [type1, sign1, value1] = FPUnpack(op1, fpcr, fpsr);
|
||||||
const auto [type2, sign2, value2] = FPUnpack<FPT>(op2, fpcr, fpsr);
|
const auto [type2, sign2, value2] = FPUnpack(op2, fpcr, fpsr);
|
||||||
|
|
||||||
if (const auto maybe_nan = FPProcessNaNs(type1, type2, op1, op2, fpcr, fpsr)) {
|
if (const auto maybe_nan = FPProcessNaNs(type1, type2, op1, op2, fpcr, fpsr)) {
|
||||||
return *maybe_nan;
|
return *maybe_nan;
|
||||||
|
@ -37,7 +37,7 @@ FPT FPRSqrtStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inf1 || inf2) {
|
if (inf1 || inf2) {
|
||||||
return FPInfo<FPT>::Infinity(sign1 != sign2);
|
return FPT(FPInfo<FPT>::Infinity(sign1 != sign2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// result_value = (3.0 + (value1 * value2)) / 2.0
|
// result_value = (3.0 + (value1 * value2)) / 2.0
|
||||||
|
@ -45,11 +45,12 @@ FPT FPRSqrtStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
|
||||||
result_value.exponent--;
|
result_value.exponent--;
|
||||||
|
|
||||||
if (result_value.mantissa == 0) {
|
if (result_value.mantissa == 0) {
|
||||||
return FPInfo<FPT>::Zero(fpcr.RMode() == RoundingMode::TowardsMinusInfinity);
|
return FPT(FPInfo<FPT>::Zero(fpcr.RMode() == RoundingMode::TowardsMinusInfinity));
|
||||||
}
|
}
|
||||||
return FPRound<FPT>(result_value, fpcr, fpsr);
|
return FPRound<FPT>(result_value, fpcr, fpsr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template u16 FPRSqrtStepFused<u16>(u16 op1, u16 op2, FPCR fpcr, FPSR& fpsr);
|
||||||
template u32 FPRSqrtStepFused<u32>(u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr);
|
template u32 FPRSqrtStepFused<u32>(u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr);
|
||||||
template u64 FPRSqrtStepFused<u64>(u64 op1, u64 op2, FPCR fpcr, FPSR& fpsr);
|
template u64 FPRSqrtStepFused<u64>(u64 op1, u64 op2, FPCR fpcr, FPSR& fpsr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue