common/fp/unpacked: Add FPRoundCV

Corresponds to the equivalent pseudocode within the ARMv8 reference
manual. This will be necessary for supporting half-precision
floating-point.

This also makes use of it within FPConvert
This commit is contained in:
Lioncash 2019-03-08 06:24:03 -05:00 committed by MerryMage
parent 490bebbd9a
commit 99c494bae9
2 changed files with 7 additions and 1 deletions

View file

@ -93,7 +93,7 @@ FPT_TO FPConvert(FPT_FROM op, FPCR fpcr, RoundingMode rounding_mode, FPSR& fpsr)
return FPInfo<FPT_TO>::Zero(sign);
}
return FPRoundBase<FPT_TO>(value, fpcr, rounding_mode, fpsr);
return FPRoundCV<FPT_TO>(value, fpcr, rounding_mode, fpsr);
}
template u64 FPConvert<u64, u32>(u32 op, FPCR fpcr, RoundingMode rounding_mode, FPSR& fpsr);

View file

@ -69,6 +69,12 @@ FPT FPRound(FPUnpacked op, FPCR fpcr, RoundingMode rounding, FPSR& fpsr) {
return FPRoundBase<FPT>(op, fpcr, rounding, fpsr);
}
template<typename FPT>
FPT FPRoundCV(FPUnpacked op, FPCR fpcr, RoundingMode rounding, FPSR& fpsr) {
fpcr.FZ16(false);
return FPRoundBase<FPT>(op, fpcr, rounding, fpsr);
}
template<typename FPT>
FPT FPRound(FPUnpacked op, FPCR fpcr, FPSR& fpsr) {
return FPRound<FPT>(op, fpcr, fpcr.RMode(), fpsr);