fp: Implement FPProcessException

This commit is contained in:
MerryMage 2018-06-27 13:51:39 +01:00
parent 3cb98e1560
commit 4875658917
3 changed files with 87 additions and 0 deletions

View file

@ -18,6 +18,8 @@ add_library(dynarmic
common/crc32.h
common/fp/fpsr.h
common/fp/info.h
common/fp/process_exception.cpp
common/fp/process_exception.h
common/fp/rounding_mode.h
common/fp/util.h
common/intrusive_list.h

View file

@ -0,0 +1,58 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2018 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#include "common/assert.h"
#include "common/fp/fpsr.h"
#include "common/fp/process_exception.h"
#include "frontend/A64/FPCR.h"
namespace Dynarmic::FP {
void FPProcessException(FPExc exception, FPCR fpcr, FPSR& fpsr) {
switch (exception) {
case FPExc::InvalidOp:
if (fpcr.IOE()) {
UNIMPLEMENTED();
}
fpsr.IOC(true);
break;
case FPExc::DivideByZero:
if (fpcr.DZE()) {
UNIMPLEMENTED();
}
fpsr.DZC(true);
break;
case FPExc::Overflow:
if (fpcr.OFE()) {
UNIMPLEMENTED();
}
fpsr.OFC(true);
break;
case FPExc::Underflow:
if (fpcr.UFE()) {
UNIMPLEMENTED();
}
fpsr.UFC(true);
break;
case FPExc::Inexact:
if (fpcr.IXE()) {
UNIMPLEMENTED();
}
fpsr.IXC(true);
break;
case FPExc::InputDenorm:
if (fpcr.IDE()) {
UNIMPLEMENTED();
}
fpsr.IDC(true);
break;
default:
UNREACHABLE();
break;
}
}
} // namespace Dynarmic::FP

View file

@ -0,0 +1,27 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2018 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#pragma once
#include "common/fp/fpsr.h"
#include "frontend/A64/FPCR.h"
namespace Dynarmic::FP {
using FPCR = A64::FPCR;
enum class FPExc {
InvalidOp,
DivideByZero,
Overflow,
Underflow,
Inexact,
InputDenorm,
};
void FPProcessException(FPExc exception, FPCR fpcr, FPSR& fpsr);
} // namespace Dynarmic::FP