Fixed a number of warnings and function inlining in LazyUSF

CQTexperiment
Chris Moeller 2014-02-16 16:20:13 -08:00
parent 5eb4b34e81
commit 5e39b592d5
8 changed files with 31 additions and 26 deletions

View File

@ -15,7 +15,7 @@ void AddBuffer(usf_state_t *state, unsigned char *buf, unsigned int length) {
do_max = length >> 2; do_max = length >> 2;
if ( do_max > state->sample_buffer_count ) if ( do_max > state->sample_buffer_count )
do_max = state->sample_buffer_count; do_max = (unsigned int) state->sample_buffer_count;
for (i = 0; i < do_max; ++i) for (i = 0; i < do_max; ++i)
{ {

View File

@ -441,7 +441,7 @@ void StartEmulationFromSave ( usf_state_t * state, void * savestate ) {
memset(state->IMEM, 0, 0x1000); memset(state->IMEM, 0, 0x1000);
memset(state->TLB_Map, 0, 0x100000 * sizeof(uintptr_t) + 0x10000); memset(state->TLB_Map, 0, 0x100000 * sizeof(uintptr_t) + 0x10000);
memset(state->CPU_Action,0,sizeof(state->CPU_Action)); memset(state->CPU_Action,0,sizeof(*state->CPU_Action));
state->WrittenToRom = 0; state->WrittenToRom = 0;
InitilizeTLB(state); InitilizeTLB(state);

View File

@ -32,9 +32,9 @@
#include "usf.h" #include "usf.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#define INLINE __inline #define INLINE __forceinline
#else #else
#define INLINE __attribute__((forceinline)) #define INLINE __attribute__((always_inline))
#endif #endif
#include "usf_internal.h" #include "usf_internal.h"
@ -503,8 +503,7 @@ void r4300i_LL (usf_state_t * state) {
state->LLAddr = Address; state->LLAddr = Address;
ll = state->LLAddr; ll = state->LLAddr;
TranslateVaddr(state, &ll); TranslateVaddr(state, &ll);
state->LLAddr = ll; state->LLAddr = (uint32_t) ll;
} }
void r4300i_LWC1 (usf_state_t * state) { void r4300i_LWC1 (usf_state_t * state) {

View File

@ -73,7 +73,7 @@ void large_free(void * p, size_t size)
#endif #endif
int32_t Allocate_Memory ( void * state ) { int32_t Allocate_Memory ( void * state ) {
uint32_t i = 0; //uint32_t i = 0;
//RdramSize = 0x800000; //RdramSize = 0x800000;
// Allocate the N64MEM and TLB_Map so that they are in each others 4GB range // Allocate the N64MEM and TLB_Map so that they are in each others 4GB range
@ -387,7 +387,7 @@ uint32_t r4300i_LW_VAddr ( usf_state_t * state, uint32_t VAddr, uint32_t * Value
if((address - (uintptr_t)state->RDRAM) > state->RdramSize) { if((address - (uintptr_t)state->RDRAM) > state->RdramSize) {
address = address - (uintptr_t)state->RDRAM; address = address - (uintptr_t)state->RDRAM;
return r4300i_LW_NonMemory(state, address, Value); return r4300i_LW_NonMemory(state, (uint32_t) address, Value);
} }
*Value = *(uint32_t *)address; *Value = *(uint32_t *)address;
return 1; return 1;
@ -770,7 +770,7 @@ uint32_t r4300i_SW_VAddr ( usf_state_t * state, uint32_t VAddr, uint32_t Value )
if((address - (uintptr_t)state->RDRAM) > state->RdramSize) { if((address - (uintptr_t)state->RDRAM) > state->RdramSize) {
address = address - (uintptr_t)state->RDRAM; address = address - (uintptr_t)state->RDRAM;
return r4300i_SW_NonMemory(state, address, Value); return r4300i_SW_NonMemory(state, (uint32_t) address, Value);
} }
*(uint32_t *)address = Value; *(uint32_t *)address = Value;
return 1; return 1;

View File

@ -51,7 +51,7 @@ void SetupRegisters(usf_state_t * state, N64_REGISTERS * n64_Registers) {
state->RegPI = n64_Registers->PI; state->RegPI = n64_Registers->PI;
state->RegRI = n64_Registers->RI; state->RegRI = n64_Registers->RI;
state->RegSI = n64_Registers->SI; state->RegSI = n64_Registers->SI;
state->PIF_Ram = n64_Registers->PIF_Ram; state->PIF_Ram = (uint8_t *) n64_Registers->PIF_Ram;
} }
void ChangeMiIntrMask (usf_state_t * state) { void ChangeMiIntrMask (usf_state_t * state) {

View File

@ -19,7 +19,7 @@
#define NOINLINE __declspec(noinline) #define NOINLINE __declspec(noinline)
#define ALIGNED _declspec(align(16)) #define ALIGNED _declspec(align(16))
#else #else
#define INLINE __attribute__((forceinline)) #define INLINE __attribute__((always_inline))
#define NOINLINE __attribute__((noinline)) #define NOINLINE __attribute__((noinline))
#define ALIGNED __attribute__((aligned(16))) #define ALIGNED __attribute__((aligned(16)))
#endif #endif
@ -37,7 +37,10 @@
typedef unsigned char byte; typedef unsigned char byte;
#ifndef RCPREG_DEFINED
#define RCPREG_DEFINED
typedef uint32_t RCPREG; typedef uint32_t RCPREG;
#endif
NOINLINE void message(const char* body, int priority) NOINLINE void message(const char* body, int priority)
{ {

View File

@ -137,7 +137,7 @@ static const int simm[16] = {
static __m128i shuffle_none(__m128i xmm) static __m128i shuffle_none(__m128i xmm)
{/* {/*
const int order = simm[0x0]; // const int order = simm[0x0];
xmm = _mm_shufflehi_epi16(xmm, order); xmm = _mm_shufflehi_epi16(xmm, order);
xmm = _mm_shufflelo_epi16(xmm, order);*/ xmm = _mm_shufflelo_epi16(xmm, order);*/
@ -145,7 +145,7 @@ static __m128i shuffle_none(__m128i xmm)
} }
static __m128i shuffle_0q(__m128i xmm) static __m128i shuffle_0q(__m128i xmm)
{ {
const int order = simm[0x2]; //const int order = simm[0x2];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(00, 00, 02, 02)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(00, 00, 02, 02));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 02, 02)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 02, 02));
@ -153,7 +153,7 @@ static __m128i shuffle_0q(__m128i xmm)
} }
static __m128i shuffle_1q(__m128i xmm) static __m128i shuffle_1q(__m128i xmm)
{ {
const int order = simm[0x3]; //const int order = simm[0x3];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(01, 01, 03, 03)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(01, 01, 03, 03));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 03, 03)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 03, 03));
@ -161,7 +161,7 @@ static __m128i shuffle_1q(__m128i xmm)
} }
static __m128i shuffle_0h(__m128i xmm) static __m128i shuffle_0h(__m128i xmm)
{ {
const int order = simm[0x4]; //const int order = simm[0x4];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(00, 00, 00, 00)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(00, 00, 00, 00));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 00, 00)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 00, 00));
@ -169,7 +169,7 @@ static __m128i shuffle_0h(__m128i xmm)
} }
static __m128i shuffle_1h(__m128i xmm) static __m128i shuffle_1h(__m128i xmm)
{ {
const int order = simm[0x5]; //const int order = simm[0x5];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(01, 01, 01, 01)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(01, 01, 01, 01));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 01, 01)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 01, 01));
@ -177,7 +177,7 @@ static __m128i shuffle_1h(__m128i xmm)
} }
static __m128i shuffle_2h(__m128i xmm) static __m128i shuffle_2h(__m128i xmm)
{ {
const int order = simm[0x6]; //const int order = simm[0x6];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(02, 02, 02, 02)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(02, 02, 02, 02));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(02, 02, 02, 02)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(02, 02, 02, 02));
@ -185,7 +185,7 @@ static __m128i shuffle_2h(__m128i xmm)
} }
static __m128i shuffle_3h(__m128i xmm) static __m128i shuffle_3h(__m128i xmm)
{ {
const int order = simm[0x7]; //const int order = simm[0x7];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(03, 03, 03, 03)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(03, 03, 03, 03));
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(03, 03, 03, 03)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(03, 03, 03, 03));
@ -193,7 +193,7 @@ static __m128i shuffle_3h(__m128i xmm)
} }
static __m128i shuffle_0w(__m128i xmm) static __m128i shuffle_0w(__m128i xmm)
{ {
const int order = simm[0x8]; //const int order = simm[0x8];
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 00, 00)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(00, 00, 00, 00));
xmm = _mm_unpacklo_epi16(xmm, xmm); xmm = _mm_unpacklo_epi16(xmm, xmm);
@ -201,7 +201,7 @@ static __m128i shuffle_0w(__m128i xmm)
} }
static __m128i shuffle_1w(__m128i xmm) static __m128i shuffle_1w(__m128i xmm)
{ {
const int order = simm[0x9]; //const int order = simm[0x9];
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 01, 01)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(01, 01, 01, 01));
xmm = _mm_unpacklo_epi16(xmm, xmm); xmm = _mm_unpacklo_epi16(xmm, xmm);
@ -209,7 +209,7 @@ static __m128i shuffle_1w(__m128i xmm)
} }
static __m128i shuffle_2w(__m128i xmm) static __m128i shuffle_2w(__m128i xmm)
{ {
const int order = simm[0xA]; //const int order = simm[0xA];
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(02, 02, 02, 02)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(02, 02, 02, 02));
xmm = _mm_unpacklo_epi16(xmm, xmm); xmm = _mm_unpacklo_epi16(xmm, xmm);
@ -217,7 +217,7 @@ static __m128i shuffle_2w(__m128i xmm)
} }
static __m128i shuffle_3w(__m128i xmm) static __m128i shuffle_3w(__m128i xmm)
{ {
const int order = simm[0xB]; //const int order = simm[0xB];
xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(03, 03, 03, 03)); xmm = _mm_shufflelo_epi16(xmm, SHUFFLE(03, 03, 03, 03));
xmm = _mm_unpacklo_epi16(xmm, xmm); xmm = _mm_unpacklo_epi16(xmm, xmm);
@ -225,7 +225,7 @@ static __m128i shuffle_3w(__m128i xmm)
} }
static __m128i shuffle_4w(__m128i xmm) static __m128i shuffle_4w(__m128i xmm)
{ {
const int order = simm[0xC]; //const int order = simm[0xC];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(04, 04, 04, 04)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(04, 04, 04, 04));
xmm = _mm_unpackhi_epi16(xmm, xmm); xmm = _mm_unpackhi_epi16(xmm, xmm);
@ -233,7 +233,7 @@ static __m128i shuffle_4w(__m128i xmm)
} }
static __m128i shuffle_5w(__m128i xmm) static __m128i shuffle_5w(__m128i xmm)
{ {
const int order = simm[0xD]; //const int order = simm[0xD];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(05, 05, 05, 05)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(05, 05, 05, 05));
xmm = _mm_unpackhi_epi16(xmm, xmm); xmm = _mm_unpackhi_epi16(xmm, xmm);
@ -241,7 +241,7 @@ static __m128i shuffle_5w(__m128i xmm)
} }
static __m128i shuffle_6w(__m128i xmm) static __m128i shuffle_6w(__m128i xmm)
{ {
const int order = simm[0xE]; //const int order = simm[0xE];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(06, 06, 06, 06)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(06, 06, 06, 06));
xmm = _mm_unpackhi_epi16(xmm, xmm); xmm = _mm_unpackhi_epi16(xmm, xmm);
@ -249,7 +249,7 @@ static __m128i shuffle_6w(__m128i xmm)
} }
static __m128i shuffle_7w(__m128i xmm) static __m128i shuffle_7w(__m128i xmm)
{ {
const int order = simm[0xF]; //const int order = simm[0xF];
xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(07, 07, 07, 07)); xmm = _mm_shufflehi_epi16(xmm, SHUFFLE(07, 07, 07, 07));
xmm = _mm_unpackhi_epi16(xmm, xmm); xmm = _mm_unpackhi_epi16(xmm, xmm);

View File

@ -6,7 +6,10 @@ struct usf_state_helper
size_t offset_to_structure; size_t offset_to_structure;
}; };
#ifndef RCPREG_DEFINED
#define RCPREG_DEFINED
typedef uint32_t RCPREG; typedef uint32_t RCPREG;
#endif
struct usf_state struct usf_state
{ {