Revert "Minor decoder optimizations, kernel fixes, cpu backend fixes"
This commit is contained in:
@@ -46,7 +46,6 @@ struct PPCDecodeData {
|
||||
uint32_t LEV() const { return bits_.LEV; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -75,7 +74,6 @@ struct PPCDecodeData {
|
||||
uint32_t L() const { return bits_.RT & 0x1; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -97,7 +95,6 @@ struct PPCDecodeData {
|
||||
int32_t ds() const { return static_cast<int32_t>(XEEXTS16(DS() << 2)); }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -177,7 +174,6 @@ struct PPCDecodeData {
|
||||
uint32_t CRFS() const { return bits_.RA >> 2; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -204,7 +200,6 @@ struct PPCDecodeData {
|
||||
uint32_t CRFS() const { return CRBA() >> 2; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -228,7 +223,6 @@ struct PPCDecodeData {
|
||||
}
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -250,7 +244,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -273,7 +266,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -297,7 +289,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -323,7 +314,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -349,7 +339,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -374,7 +363,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -401,7 +389,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -425,7 +412,6 @@ struct PPCDecodeData {
|
||||
int32_t SIMM() const { return static_cast<int32_t>(XEEXTS16(VA())); }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -445,7 +431,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -467,7 +452,6 @@ struct PPCDecodeData {
|
||||
uint32_t SHB() const { return VC() & 0xF; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -489,7 +473,6 @@ struct PPCDecodeData {
|
||||
uint32_t VB() const { return bits_.VB128l | (bits_.VB128h << 5); }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -515,7 +498,6 @@ struct PPCDecodeData {
|
||||
uint32_t RB() const { return bits_.RB; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -539,7 +521,6 @@ struct PPCDecodeData {
|
||||
uint32_t VC() const { return bits_.VC; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -565,7 +546,6 @@ struct PPCDecodeData {
|
||||
int32_t SIMM() const { return static_cast<int32_t>(XEEXTS16(bits_.UIMM)); }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -587,7 +567,6 @@ struct PPCDecodeData {
|
||||
uint32_t z() const { return bits_.z; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -613,7 +592,6 @@ struct PPCDecodeData {
|
||||
uint32_t SH() const { return bits_.SH; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -640,7 +618,6 @@ struct PPCDecodeData {
|
||||
bool Rc() const { return bits_.Rc ? true : false; }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
@@ -665,7 +642,6 @@ struct PPCDecodeData {
|
||||
uint32_t UIMM() const { return bits_.PERMl | (bits_.PERMh << 5); }
|
||||
|
||||
private:
|
||||
XE_MAYBE_UNUSED
|
||||
uint32_t address_;
|
||||
union {
|
||||
uint32_t value_;
|
||||
|
||||
@@ -2014,7 +2014,8 @@ int InstrEmit_vupkhsh(PPCHIRBuilder& f, const InstrData& i) {
|
||||
return InstrEmit_vupkhsh_(f, i.VX.VD, i.VX.VB);
|
||||
}
|
||||
int InstrEmit_vupkhsh128(PPCHIRBuilder& f, const InstrData& i) {
|
||||
assert_zero(VX128_VA128);
|
||||
uint32_t va = VX128_VA128;
|
||||
assert_zero(va);
|
||||
return InstrEmit_vupkhsh_(f, VX128_VD128, VX128_VB128);
|
||||
}
|
||||
|
||||
@@ -2031,7 +2032,8 @@ int InstrEmit_vupklsh(PPCHIRBuilder& f, const InstrData& i) {
|
||||
return InstrEmit_vupklsh_(f, i.VX.VD, i.VX.VB);
|
||||
}
|
||||
int InstrEmit_vupklsh128(PPCHIRBuilder& f, const InstrData& i) {
|
||||
assert_zero(VX128_VA128);
|
||||
uint32_t va = VX128_VA128;
|
||||
assert_zero(va);
|
||||
return InstrEmit_vupklsh_(f, VX128_VD128, VX128_VB128);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "xenia/cpu/ppc/ppc_hir_builder.h"
|
||||
|
||||
DEFINE_bool(
|
||||
disable_prefetch_and_cachecontrol, true,
|
||||
disable_prefetch_and_cachecontrol, false,
|
||||
"Disables translating ppc prefetch/cache flush instructions to host "
|
||||
"prefetch/cacheflush instructions. This may improve performance as these "
|
||||
"instructions were written with the Xbox 360's cache in mind, and modern "
|
||||
|
||||
@@ -105,11 +105,6 @@ bool PPCFrontend::Initialize() {
|
||||
}
|
||||
|
||||
bool PPCFrontend::DeclareFunction(GuestFunction* function) {
|
||||
|
||||
//chrispy: make sure we aren't declaring a function that is actually padding data, this will mess up PPCScanner and is hard to debug
|
||||
//wow, this halo reach actually has branches into 0 opcodes, look into further
|
||||
//xenia_assert(*reinterpret_cast<const uint32_t*>(
|
||||
// this->memory()->TranslateVirtual(function->address())) != 0);
|
||||
// Could scan or something here.
|
||||
// Could also check to see if it's a well-known function type and classify
|
||||
// for later.
|
||||
|
||||
@@ -34,11 +34,6 @@ DEFINE_bool(
|
||||
"unimplemented PowerPC instruction is encountered.",
|
||||
"CPU");
|
||||
|
||||
DEFINE_bool(
|
||||
emit_useless_fpscr_updates, false,
|
||||
"Emit useless fpscr update instructions (pre-10/30/2022 behavior). ",
|
||||
"CPU");
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace ppc {
|
||||
@@ -94,9 +89,6 @@ bool PPCHIRBuilder::Emit(GuestFunction* function, uint32_t flags) {
|
||||
|
||||
function_ = function;
|
||||
start_address_ = function_->address();
|
||||
//chrispy: i've seen this one happen, not sure why but i think from trying to precompile twice
|
||||
//i've also seen ones with a start and end address that are the same...
|
||||
assert_true(function_->address() <= function_->end_address());
|
||||
instr_count_ = (function_->end_address() - function_->address()) / 4 + 1;
|
||||
|
||||
with_debug_info_ = (flags & EMIT_DEBUG_COMMENTS) == EMIT_DEBUG_COMMENTS;
|
||||
@@ -250,7 +242,6 @@ void PPCHIRBuilder::MaybeBreakOnInstruction(uint32_t address) {
|
||||
}
|
||||
|
||||
void PPCHIRBuilder::AnnotateLabel(uint32_t address, Label* label) {
|
||||
//chrispy: label->name is unused, it would be nice to be able to remove the field and this code
|
||||
char name_buffer[13];
|
||||
auto format_result = fmt::format_to_n(name_buffer, 12, "loc_{:08X}", address);
|
||||
name_buffer[format_result.size] = '\0';
|
||||
@@ -456,38 +447,31 @@ void PPCHIRBuilder::StoreFPSCR(Value* value) {
|
||||
void PPCHIRBuilder::UpdateFPSCR(Value* result, bool update_cr1) {
|
||||
// TODO(benvanik): detect overflow and nan cases.
|
||||
// fx and vx are the most important.
|
||||
/*
|
||||
chrispy: stubbed this out because right now all it does is waste
|
||||
memory and CPU time
|
||||
*/
|
||||
if (cvars::emit_useless_fpscr_updates) {
|
||||
Value* fx = LoadConstantInt8(0);
|
||||
Value* fex = LoadConstantInt8(0);
|
||||
Value* vx = LoadConstantInt8(0);
|
||||
Value* ox = LoadConstantInt8(0);
|
||||
Value* fx = LoadConstantInt8(0);
|
||||
Value* fex = LoadConstantInt8(0);
|
||||
Value* vx = LoadConstantInt8(0);
|
||||
Value* ox = LoadConstantInt8(0);
|
||||
|
||||
if (update_cr1) {
|
||||
// Store into the CR1 field.
|
||||
// We do this instead of just calling CopyFPSCRToCR1 so that we don't
|
||||
// have to read back the bits and do shifting work.
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_fx), fx);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_fex), fex);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_vx), vx);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_ox), ox);
|
||||
}
|
||||
|
||||
// Generate our new bits.
|
||||
Value* new_bits = Shl(ZeroExtend(fx, INT32_TYPE), 31);
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(fex, INT32_TYPE), 30));
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(vx, INT32_TYPE), 29));
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(ox, INT32_TYPE), 28));
|
||||
|
||||
// Mix into fpscr while preserving sticky bits (FX and OX).
|
||||
Value* bits = LoadFPSCR();
|
||||
bits = Or(And(bits, LoadConstantUint32(0x9FFFFFFF)), new_bits);
|
||||
StoreFPSCR(bits);
|
||||
if (update_cr1) {
|
||||
// Store into the CR1 field.
|
||||
// We do this instead of just calling CopyFPSCRToCR1 so that we don't
|
||||
// have to read back the bits and do shifting work.
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_fx), fx);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_fex), fex);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_vx), vx);
|
||||
StoreContext(offsetof(PPCContext, cr1.cr1_ox), ox);
|
||||
}
|
||||
|
||||
// Generate our new bits.
|
||||
Value* new_bits = Shl(ZeroExtend(fx, INT32_TYPE), 31);
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(fex, INT32_TYPE), 30));
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(vx, INT32_TYPE), 29));
|
||||
new_bits = Or(new_bits, Shl(ZeroExtend(ox, INT32_TYPE), 28));
|
||||
|
||||
// Mix into fpscr while preserving sticky bits (FX and OX).
|
||||
Value* bits = LoadFPSCR();
|
||||
bits = Or(And(bits, LoadConstantUint32(0x9FFFFFFF)), new_bits);
|
||||
StoreFPSCR(bits);
|
||||
}
|
||||
|
||||
void PPCHIRBuilder::CopyFPSCRToCR1() {
|
||||
|
||||
@@ -21,7 +21,13 @@ namespace xe {
|
||||
namespace cpu {
|
||||
namespace ppc {
|
||||
|
||||
struct PPCOpcodeBits {
|
||||
// DEPRECATED
|
||||
// TODO(benvanik): move code to PPCDecodeData.
|
||||
struct InstrData {
|
||||
PPCOpcode opcode;
|
||||
const PPCOpcodeInfo* opcode_info;
|
||||
uint32_t address;
|
||||
|
||||
union {
|
||||
uint32_t code;
|
||||
|
||||
@@ -323,14 +329,6 @@ struct PPCOpcodeBits {
|
||||
};
|
||||
};
|
||||
|
||||
// DEPRECATED
|
||||
// TODO(benvanik): move code to PPCDecodeData.
|
||||
struct InstrData : public PPCOpcodeBits {
|
||||
PPCOpcode opcode;
|
||||
const PPCOpcodeInfo* opcode_info;
|
||||
uint32_t address;
|
||||
};
|
||||
|
||||
} // namespace ppc
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
Reference in New Issue
Block a user