Cleanup previous commit.

This commit is contained in:
Maxim Poliakovski 2023-12-19 11:58:12 +01:00
parent 7f229b0fe8
commit 9dbfde1a4c
2 changed files with 10 additions and 13 deletions

View File

@ -259,8 +259,9 @@ enum FPSCR : uint32_t {
FPCC_ZERO = 1UL << 13,
FPCC_POS = 1UL << 14,
FPCC_NEG = 1UL << 15,
FPCC_FPRCD = 1UL << 16,
FPRF_MASK = FPCC_FPRCD | FPCC_NEG | FPCC_POS | FPCC_ZERO | FPCC_FUNAN,
FPCC_MASK = FPCC_NEG | FPCC_POS | FPCC_ZERO | FPCC_FUNAN,
FPRCD = 1UL << 16,
FPRF_MASK = FPRCD | FPCC_MASK,
FI = 1UL << 17,
FR = 1UL << 18,
VXVC = 1UL << 19,

View File

@ -221,7 +221,7 @@ void ppc_confirm_inf_nan(int chosen_reg_1, int chosen_reg_2, bool rc_flag = fals
static void fpresult_update(double set_result) {
if (std::isnan(set_result)) {
ppc_state.fpscr |= FPCC_FUNAN | FPCC_FPRCD;
ppc_state.fpscr |= FPCC_FUNAN | FPRCD;
} else {
if (set_result > 0.0) {
ppc_state.fpscr |= FPCC_POS;
@ -940,6 +940,9 @@ void dppc_interpreter::ppc_fcmpo() {
uint32_t cmp_c = 0;
if (std::isnan(db_test_a) || std::isnan(db_test_b)) {
// TODO: test for SNAN operands
// for now, assume that at least one of the operands is QNAN
ppc_state.fpscr |= FPSCR::VXVC;
cmp_c |= (1 << CRx_bit::CR_SO);
}
else if (db_test_a < db_test_b) {
@ -952,12 +955,8 @@ void dppc_interpreter::ppc_fcmpo() {
cmp_c |= (1 << CRx_bit::CR_EQ);
}
ppc_state.fpscr = (ppc_state.fpscr & 0xFFFF0FFF) | (cmp_c >> 16); // FL,FG,FE,FU
ppc_state.fpscr = (ppc_state.fpscr & ~FPSCR::FPCC_MASK) | (cmp_c >> 16); // update FPCC
ppc_state.cr = ((ppc_state.cr & ~(0xF0000000 >> crf_d)) | ((cmp_c) >> crf_d));
//if (std::isnan(db_test_a) || std::isnan(db_test_b)) {
// ppc_state.fpscr |= FPSCR::FX | FPSCR::VX | FPSCR::VXSNAN;
//}
}
void dppc_interpreter::ppc_fcmpu() {
@ -966,6 +965,7 @@ void dppc_interpreter::ppc_fcmpu() {
uint32_t cmp_c = 0;
if (std::isnan(db_test_a) || std::isnan(db_test_b)) {
// TODO: test for SNAN operands
cmp_c |= (1 << CRx_bit::CR_SO);
}
else if (db_test_a < db_test_b) {
@ -978,10 +978,6 @@ void dppc_interpreter::ppc_fcmpu() {
cmp_c |= (1 << CRx_bit::CR_EQ);
}
ppc_state.fpscr = (ppc_state.fpscr & 0xFFFF0FFF) | (cmp_c >> 16); // FL,FG,FE,FU
ppc_state.fpscr = (ppc_state.fpscr & ~FPSCR::FPCC_MASK) | (cmp_c >> 16); // update FPCC
ppc_state.cr = ((ppc_state.cr & ~(0xF0000000 >> crf_d)) | ((cmp_c) >> crf_d));
//if (std::isnan(db_test_a) || std::isnan(db_test_b)) {
// ppc_state.fpscr |= FPSCR::VX | FPSCR::VXSNAN;
//}
}