diff --git a/src/arch/arm/isa/includes.isa b/src/arch/arm/isa/includes.isa index 16d4c1c866..a09655b65f 100644 --- a/src/arch/arm/isa/includes.isa +++ b/src/arch/arm/isa/includes.isa @@ -108,17 +108,12 @@ output exec {{ #include "arch/generic/memhelpers.hh" #include "base/condcodes.hh" #include "base/crc.hh" +#include "base/fenv.hh" #include "cpu/base.hh" -#include "sim/pseudo_inst.hh" - -#if defined(linux) -#include - -#endif - #include "debug/Arm.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" +#include "sim/pseudo_inst.hh" #include "sim/sim_exit.hh" using namespace ArmISA; diff --git a/src/arch/arm/isa/insts/fp.isa b/src/arch/arm/isa/insts/fp.isa index 07be0e19ab..a32b396017 100644 --- a/src/arch/arm/isa/insts/fp.isa +++ b/src/arch/arm/isa/insts/fp.isa @@ -1106,11 +1106,13 @@ let {{ FPSCR fpscr = (FPSCR) FpscrExc; vfpFlushToZero(fpscr, FpOp1); VfpSavedState state = prepFpState(fpscr.rMode); - fesetround(FeRoundZero); + Gem5::RoundingMode old_rm = Gem5::getFpRound(); + Gem5::setFpRound(Gem5::RoundingMode::TowardZero); __asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1)); FpDest_uw = vfpFpToFixed( FpOp1, false, 32, 0, true, {round_mode}); __asm__ __volatile__("" :: "m" (FpDest_uw)); + Gem5::setFpRound(old_rm); finishVfp(fpscr, state, fpscr.fz); FpscrExc = fpscr; ''' @@ -1122,11 +1124,13 @@ let {{ double cOp1 = dbl(FpOp1P0_uw, FpOp1P1_uw); vfpFlushToZero(fpscr, cOp1); VfpSavedState state = prepFpState(fpscr.rMode); - fesetround(FeRoundZero); + Gem5::RoundingMode old_rm = Gem5::getFpRound(); + Gem5::setFpRound(Gem5::RoundingMode::TowardZero); __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1)); uint64_t result = vfpFpToFixed( cOp1, false, 32, 0, true, {round_mode}); __asm__ __volatile__("" :: "m" (result)); + Gem5::setFpRound(old_rm); finishVfp(fpscr, state, fpscr.fz); FpDestP0_uw = result; FpscrExc = fpscr; @@ -1138,11 +1142,13 @@ let {{ FPSCR fpscr = (FPSCR) FpscrExc; vfpFlushToZero(fpscr, FpOp1); VfpSavedState state = prepFpState(fpscr.rMode); - fesetround(FeRoundZero); + Gem5::RoundingMode old_rm = Gem5::getFpRound(); + Gem5::setFpRound(Gem5::RoundingMode::TowardZero); __asm__ __volatile__("" : "=m" (FpOp1) : "m" (FpOp1)); FpDest_sw = vfpFpToFixed( FpOp1, true, 32, 0, true, {round_mode}); __asm__ __volatile__("" :: "m" (FpDest_sw)); + Gem5::setFpRound(old_rm); finishVfp(fpscr, state, fpscr.fz); FpscrExc = fpscr; ''' @@ -1154,11 +1160,13 @@ let {{ double cOp1 = dbl(FpOp1P0_uw, FpOp1P1_uw); vfpFlushToZero(fpscr, cOp1); VfpSavedState state = prepFpState(fpscr.rMode); - fesetround(FeRoundZero); + Gem5::RoundingMode old_rm = Gem5::getFpRound(); + Gem5::setFpRound(Gem5::RoundingMode::TowardZero); __asm__ __volatile__("" : "=m" (cOp1) : "m" (cOp1)); int64_t result = vfpFpToFixed( cOp1, true, 32, 0, true, {round_mode}); __asm__ __volatile__("" :: "m" (result)); + Gem5::setFpRound(old_rm); finishVfp(fpscr, state, fpscr.fz); FpDestP0_uw = result; FpscrExc = fpscr;