backend_x86: Add FPSCR_RMode to EmitContext

This commit is contained in:
MerryMage 2018-07-14 07:08:15 +01:00
parent 8c65d58cb8
commit a2eb9a02e0
5 changed files with 12 additions and 0 deletions

View file

@ -58,6 +58,10 @@ A32::LocationDescriptor A32EmitContext::Location() const {
return A32::LocationDescriptor{block.Location()}; return A32::LocationDescriptor{block.Location()};
} }
FP::RoundingMode A32EmitContext::FPSCR_RMode() const {
return Location().FPSCR().RMode();
}
bool A32EmitContext::FPSCR_RoundTowardsZero() const { bool A32EmitContext::FPSCR_RoundTowardsZero() const {
return Location().FPSCR().RMode() != FP::RoundingMode::TowardsZero; return Location().FPSCR().RMode() != FP::RoundingMode::TowardsZero;
} }

View file

@ -23,6 +23,7 @@ class RegAlloc;
struct A32EmitContext final : public EmitContext { struct A32EmitContext final : public EmitContext {
A32EmitContext(RegAlloc& reg_alloc, IR::Block& block); A32EmitContext(RegAlloc& reg_alloc, IR::Block& block);
A32::LocationDescriptor Location() const; A32::LocationDescriptor Location() const;
FP::RoundingMode FPSCR_RMode() const override;
bool FPSCR_RoundTowardsZero() const override; bool FPSCR_RoundTowardsZero() const override;
bool FPSCR_FTZ() const override; bool FPSCR_FTZ() const override;
bool FPSCR_DN() const override; bool FPSCR_DN() const override;

View file

@ -40,6 +40,10 @@ A64::LocationDescriptor A64EmitContext::Location() const {
return A64::LocationDescriptor{block.Location()}; return A64::LocationDescriptor{block.Location()};
} }
FP::RoundingMode A64EmitContext::FPSCR_RMode() const {
return Location().FPCR().RMode();
}
bool A64EmitContext::FPSCR_RoundTowardsZero() const { bool A64EmitContext::FPSCR_RoundTowardsZero() const {
return Location().FPCR().RMode() != FP::RoundingMode::TowardsZero; return Location().FPCR().RMode() != FP::RoundingMode::TowardsZero;
} }

View file

@ -23,6 +23,7 @@ class RegAlloc;
struct A64EmitContext final : public EmitContext { struct A64EmitContext final : public EmitContext {
A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block); A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block);
A64::LocationDescriptor Location() const; A64::LocationDescriptor Location() const;
FP::RoundingMode FPSCR_RMode() const override;
bool FPSCR_RoundTowardsZero() const override; bool FPSCR_RoundTowardsZero() const override;
bool FPSCR_FTZ() const override; bool FPSCR_FTZ() const override;
bool FPSCR_DN() const override; bool FPSCR_DN() const override;

View file

@ -16,6 +16,7 @@
#include "backend_x64/reg_alloc.h" #include "backend_x64/reg_alloc.h"
#include "common/address_range.h" #include "common/address_range.h"
#include "common/fp/rounding_mode.h"
#include "frontend/ir/location_descriptor.h" #include "frontend/ir/location_descriptor.h"
#include "frontend/ir/terminal.h" #include "frontend/ir/terminal.h"
@ -33,6 +34,7 @@ struct EmitContext {
void EraseInstruction(IR::Inst* inst); void EraseInstruction(IR::Inst* inst);
virtual FP::RoundingMode FPSCR_RMode() const = 0;
virtual bool FPSCR_RoundTowardsZero() const = 0; virtual bool FPSCR_RoundTowardsZero() const = 0;
virtual bool FPSCR_FTZ() const = 0; virtual bool FPSCR_FTZ() const = 0;
virtual bool FPSCR_DN() const = 0; virtual bool FPSCR_DN() const = 0;