From 760cc3ca893ce8dc36cb0a6d6ce287fad4007846 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 15 Jul 2018 14:23:50 +0100 Subject: [PATCH] EmitContext: Expose FPCR --- src/backend_x64/a32_emit_x64.cpp | 4 ++++ src/backend_x64/a32_emit_x64.h | 1 + src/backend_x64/a64_emit_x64.cpp | 4 ++++ src/backend_x64/a64_emit_x64.h | 1 + src/backend_x64/emit_x64.h | 1 + 5 files changed, 11 insertions(+) diff --git a/src/backend_x64/a32_emit_x64.cpp b/src/backend_x64/a32_emit_x64.cpp index bf9fadcf..c027761d 100644 --- a/src/backend_x64/a32_emit_x64.cpp +++ b/src/backend_x64/a32_emit_x64.cpp @@ -62,6 +62,10 @@ FP::RoundingMode A32EmitContext::FPSCR_RMode() const { return Location().FPSCR().RMode(); } +u32 A32EmitContext::FPCR() const { + return Location().FPSCR().Value(); +} + bool A32EmitContext::FPSCR_RoundTowardsZero() const { return Location().FPSCR().RMode() != FP::RoundingMode::TowardsZero; } diff --git a/src/backend_x64/a32_emit_x64.h b/src/backend_x64/a32_emit_x64.h index bec1663d..254d4a9e 100644 --- a/src/backend_x64/a32_emit_x64.h +++ b/src/backend_x64/a32_emit_x64.h @@ -24,6 +24,7 @@ struct A32EmitContext final : public EmitContext { A32EmitContext(RegAlloc& reg_alloc, IR::Block& block); A32::LocationDescriptor Location() const; FP::RoundingMode FPSCR_RMode() const override; + u32 FPCR() const override; bool FPSCR_RoundTowardsZero() const override; bool FPSCR_FTZ() const override; bool FPSCR_DN() const override; diff --git a/src/backend_x64/a64_emit_x64.cpp b/src/backend_x64/a64_emit_x64.cpp index 2c30b9f7..70e41b28 100644 --- a/src/backend_x64/a64_emit_x64.cpp +++ b/src/backend_x64/a64_emit_x64.cpp @@ -44,6 +44,10 @@ FP::RoundingMode A64EmitContext::FPSCR_RMode() const { return Location().FPCR().RMode(); } +u32 A64EmitContext::FPCR() const { + return Location().FPCR().Value(); +} + bool A64EmitContext::FPSCR_RoundTowardsZero() const { return Location().FPCR().RMode() != FP::RoundingMode::TowardsZero; } diff --git a/src/backend_x64/a64_emit_x64.h b/src/backend_x64/a64_emit_x64.h index 2ecf0883..e251a963 100644 --- a/src/backend_x64/a64_emit_x64.h +++ b/src/backend_x64/a64_emit_x64.h @@ -24,6 +24,7 @@ struct A64EmitContext final : public EmitContext { A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block); A64::LocationDescriptor Location() const; FP::RoundingMode FPSCR_RMode() const override; + u32 FPCR() const override; bool FPSCR_RoundTowardsZero() const override; bool FPSCR_FTZ() const override; bool FPSCR_DN() const override; diff --git a/src/backend_x64/emit_x64.h b/src/backend_x64/emit_x64.h index 47f47bd3..64f66967 100644 --- a/src/backend_x64/emit_x64.h +++ b/src/backend_x64/emit_x64.h @@ -35,6 +35,7 @@ struct EmitContext { void EraseInstruction(IR::Inst* inst); virtual FP::RoundingMode FPSCR_RMode() const = 0; + virtual u32 FPCR() const = 0; virtual bool FPSCR_RoundTowardsZero() const = 0; virtual bool FPSCR_FTZ() const = 0; virtual bool FPSCR_DN() const = 0;