Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #147 from Tilka/misc
Misc
  • Loading branch information
delroth committed Mar 9, 2014
2 parents b003fd7 + d05e205 commit 2254e5a
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 103 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -5,7 +5,7 @@ Thumbs.db
# Ignore autogenerated source files
Source/Core/Common/scmrev.h
# Ignore files output by build
/[Bb]uild/
/[Bb]uild[-_]*/
/[Bb]inary/
/obj/
# Ignore various files created by visual studio/msbuild
Expand All @@ -22,3 +22,5 @@ CMakeLists.txt.user
*~
# Ignore transifex configuration directory
.tx
# Ignore kdevelop files/dirs
*.kdev4
318 changes: 231 additions & 87 deletions Source/Android/android.toolchain.cmake

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions Source/Core/Common/FPURoundMode.h
Expand Up @@ -8,24 +8,29 @@

namespace FPURoundMode
{
enum RoundModes : u32
// TODO: MSVC currently produces broken code:
// https://connect.microsoft.com/VisualStudio/feedback/details/828892/vc-2013-miscompilation-with-enums-and-bit-fields
// Once that is fixed, change types in SetRoundMode(), SetSIMDMode(), and in UReg_FPSCR to 'RoundMode'.

enum RoundMode
{
ROUND_NEAR = 0,
ROUND_CHOP = 1,
ROUND_UP = 2,
ROUND_DOWN = 3
};
enum PrecisionModes : u32
enum PrecisionMode
{
PREC_24 = 0,
PREC_53 = 1,
PREC_64 = 2
};
void SetRoundMode(RoundModes mode);

void SetPrecisionMode(PrecisionModes mode);
void SetRoundMode(int mode);

void SetPrecisionMode(PrecisionMode mode);

void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode);
void SetSIMDMode(int rounding_mode, bool non_ieee_mode);

/*
* There are two different flavors of float to int conversion:
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Common/GenericFPURoundMode.cpp
Expand Up @@ -21,13 +21,13 @@
// Generic, do nothing
namespace FPURoundMode
{
void SetRoundMode(RoundModes mode)
void SetRoundMode(int mode)
{
}
void SetPrecisionMode(PrecisionModes mode)
void SetPrecisionMode(PrecisionMode mode)
{
}
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
void SetSIMDMode(int rounding_mode, bool non_ieee_mode)
{
}
void SaveSIMDState()
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Common/x64FPURoundMode.cpp
Expand Up @@ -18,7 +18,7 @@ namespace FPURoundMode
static u32 saved_sse_state = _mm_getcsr();
static const u32 default_sse_state = _mm_getcsr();

void SetRoundMode(RoundModes mode)
void SetRoundMode(int mode)
{
// Set FPU rounding mode to mimic the PowerPC's
#ifdef _M_X86_32
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace FPURoundMode
#endif
}

void SetPrecisionMode(PrecisionModes mode)
void SetPrecisionMode(PrecisionMode mode)
{
#ifdef _M_X86_32
// sets the floating-point lib to 53-bit
Expand All @@ -75,7 +75,7 @@ namespace FPURoundMode
#endif
}

void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
void SetSIMDMode(int rounding_mode, bool non_ieee_mode)
{
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
const u32 EXCEPTION_MASK = 0x1F80;
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/Core/PowerPC/Gekko.h
Expand Up @@ -8,7 +8,6 @@
#pragma once

#include "Common/Common.h"
#include "Common/FPURoundMode.h"

// --- Gekko Instruction ---

Expand Down Expand Up @@ -390,7 +389,7 @@ union UReg_FPSCR
struct
{
// Rounding mode (towards: nearest, zero, +inf, -inf)
FPURoundMode::RoundModes RN : 2;
u32 RN : 2;
// Non-IEEE mode enable (aka flush-to-zero)
u32 NI : 1;
// Inexact exception enable
Expand Down
Expand Up @@ -49,7 +49,7 @@ static void FPSCRtoFPUSettings(UReg_FPSCR fp)
}

// Set SSE rounding mode and denormal handling
FPURoundMode::SetSIMDMode(FPSCR.RN, FPSCR.NI);
FPURoundMode::SetSIMDMode(fp.RN, fp.NI);
}

void Interpreter::mtfsb0x(UGeckoInstruction _inst)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
Expand Up @@ -2190,6 +2190,7 @@ void Jit64::twx(UGeckoInstruction inst)
FixupBranch ag = J_CC(CC_G);
FixupBranch ae = J_CC(CC_Z);
// FIXME: will never be reached. But also no known code uses it...
_assert_msg_(DYNA_REC, (inst.TO & 3) == 0, "Seems like something actually does use this.");
FixupBranch ll = J_CC(CC_NO);
FixupBranch lg = J_CC(CC_O);

Expand Down
2 changes: 1 addition & 1 deletion Source/UnitTests/Core/MMIOTest.cpp
Expand Up @@ -73,7 +73,7 @@ TEST_F(MappingTest, ReadWriteDirect)
m_mapping->Register(0xCC001234, MMIO::DirectRead<u16>(&target_16), MMIO::DirectWrite<u16>(&target_16));
m_mapping->Register(0xCC001234, MMIO::DirectRead<u32>(&target_32), MMIO::DirectWrite<u32>(&target_32));

for (int i = 0; i < 100; ++i)
for (u32 i = 0; i < 100; ++i)
{
u8 val8; m_mapping->Read(0xCC001234, &val8); EXPECT_EQ(i, val8);
u16 val16; m_mapping->Read(0xCC001234, &val16); EXPECT_EQ(i, val16);
Expand Down

0 comments on commit 2254e5a

Please sign in to comment.