Old style mfcr.
This commit is contained in:
parent
7b48332782
commit
93ded5ef0f
|
@ -547,7 +547,8 @@ XEEMITTER(mfcr, 0x7C000026, XFX)(PPCHIRBuilder& f, InstrData& i) {
|
|||
// extrwi r3, r10, 1, 26
|
||||
// Could recognize this and only load the appropriate CR bit.
|
||||
|
||||
assert_true(i.XFX.spr & (1 << 9));
|
||||
Value* v;
|
||||
if (i.XFX.spr & (1 << 9)) {
|
||||
uint32_t bits = (i.XFX.spr & 0x1FF) >> 1;
|
||||
int count = 0;
|
||||
int cri = 0;
|
||||
|
@ -557,12 +558,14 @@ XEEMITTER(mfcr, 0x7C000026, XFX)(PPCHIRBuilder& f, InstrData& i) {
|
|||
++count;
|
||||
}
|
||||
}
|
||||
Value* v;
|
||||
if (count == 1) {
|
||||
v = f.LoadCR(cri);
|
||||
} else {
|
||||
v = f.LoadZero(INT64_TYPE);
|
||||
}
|
||||
} else {
|
||||
v = f.LoadCR();
|
||||
}
|
||||
f.StoreGPR(i.XFX.RT, v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -252,6 +252,16 @@ void PPCHIRBuilder::StoreCTR(Value* value) {
|
|||
trace_reg.value = value;
|
||||
}
|
||||
|
||||
Value* PPCHIRBuilder::LoadCR() {
|
||||
// All bits. This is expensive, but seems to be less used than the
|
||||
// field-specific LoadCR.
|
||||
Value* v = LoadCR(0);
|
||||
for (int i = 1; i <= 7; ++i) {
|
||||
v = Or(v, LoadCR(i));
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
Value* PPCHIRBuilder::LoadCR(uint32_t n) {
|
||||
// Construct the entire word of just the bits we care about.
|
||||
// This makes it easier for the optimizer to exclude things, though
|
||||
|
|
|
@ -50,6 +50,7 @@ class PPCHIRBuilder : public hir::HIRBuilder {
|
|||
void StoreLR(Value* value);
|
||||
Value* LoadCTR();
|
||||
void StoreCTR(Value* value);
|
||||
Value* LoadCR();
|
||||
Value* LoadCR(uint32_t n);
|
||||
Value* LoadCRField(uint32_t n, uint32_t bit);
|
||||
void StoreCR(uint32_t n, Value* value);
|
||||
|
|
|
@ -33,6 +33,7 @@ KernelState* shared_kernel_state_ = nullptr;
|
|||
KernelState::KernelState(Emulator* emulator)
|
||||
: emulator_(emulator),
|
||||
memory_(emulator->memory()),
|
||||
object_table_(nullptr),
|
||||
has_notified_startup_(false),
|
||||
process_type_(X_PROCTYPE_USER),
|
||||
executable_module_(nullptr) {
|
||||
|
|
Loading…
Reference in New Issue