Fiddling.

This commit is contained in:
Ben Vanik 2013-12-25 21:58:40 -08:00
parent e07ced0f00
commit 76be00dfdf
2 changed files with 6 additions and 2 deletions

View File

@ -1112,7 +1112,7 @@ uint32_t IntCode_LOAD_CONTEXT_I32(IntCodeState& ics, const IntCode* i) {
} }
uint32_t IntCode_LOAD_CONTEXT_I64(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_LOAD_CONTEXT_I64(IntCodeState& ics, const IntCode* i) {
ics.rf[i->dest_reg].i64 = *((int64_t*)(ics.context + ics.rf[i->src1_reg].u64)); ics.rf[i->dest_reg].i64 = *((int64_t*)(ics.context + ics.rf[i->src1_reg].u64));
DPRINT("%d (%.X) = ctx i64 +%d\n", ics.rf[i->dest_reg].i64, ics.rf[i->dest_reg].u64, ics.rf[i->src1_reg].u64); DPRINT("%lld (%.llX) = ctx i64 +%d\n", ics.rf[i->dest_reg].i64, ics.rf[i->dest_reg].u64, ics.rf[i->src1_reg].u64);
return IA_NEXT; return IA_NEXT;
} }
uint32_t IntCode_LOAD_CONTEXT_F32(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_LOAD_CONTEXT_F32(IntCodeState& ics, const IntCode* i) {
@ -1163,7 +1163,7 @@ uint32_t IntCode_STORE_CONTEXT_I32(IntCodeState& ics, const IntCode* i) {
} }
uint32_t IntCode_STORE_CONTEXT_I64(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_STORE_CONTEXT_I64(IntCodeState& ics, const IntCode* i) {
*((int64_t*)(ics.context + ics.rf[i->src1_reg].u64)) = ics.rf[i->src2_reg].i64; *((int64_t*)(ics.context + ics.rf[i->src1_reg].u64)) = ics.rf[i->src2_reg].i64;
DPRINT("ctx i64 +%d = %d (%.X)\n", ics.rf[i->src1_reg].u64, ics.rf[i->src2_reg].i64, ics.rf[i->src2_reg].u64); DPRINT("ctx i64 +%d = %lld (%.llX)\n", ics.rf[i->src1_reg].u64, ics.rf[i->src2_reg].i64, ics.rf[i->src2_reg].u64);
return IA_NEXT; return IA_NEXT;
} }
uint32_t IntCode_STORE_CONTEXT_F32(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_STORE_CONTEXT_F32(IntCodeState& ics, const IntCode* i) {
@ -2792,10 +2792,12 @@ uint32_t IntCode_ROTATE_LEFT_I16(IntCodeState& ics, const IntCode* i) {
return IA_NEXT; return IA_NEXT;
} }
uint32_t IntCode_ROTATE_LEFT_I32(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_ROTATE_LEFT_I32(IntCodeState& ics, const IntCode* i) {
// TODO(benvanik): use _rtol on vc++
ics.rf[i->dest_reg].i32 = ROTL<uint32_t>(ics.rf[i->src1_reg].i32, ics.rf[i->src2_reg].i8); ics.rf[i->dest_reg].i32 = ROTL<uint32_t>(ics.rf[i->src1_reg].i32, ics.rf[i->src2_reg].i8);
return IA_NEXT; return IA_NEXT;
} }
uint32_t IntCode_ROTATE_LEFT_I64(IntCodeState& ics, const IntCode* i) { uint32_t IntCode_ROTATE_LEFT_I64(IntCodeState& ics, const IntCode* i) {
// TODO(benvanik): use _rtol64 on vc++
ics.rf[i->dest_reg].i64 = ROTL<uint64_t>(ics.rf[i->src1_reg].i64, ics.rf[i->src2_reg].i8); ics.rf[i->dest_reg].i64 = ROTL<uint64_t>(ics.rf[i->src1_reg].i64, ics.rf[i->src2_reg].i8);
return IA_NEXT; return IA_NEXT;
} }

View File

@ -971,6 +971,8 @@ XEEMITTER(rlwinmx, 0x54000000, M )(PPCFunctionBuilder& f, InstrData& i) {
// m <- MASK(MB+32, ME+32) // m <- MASK(MB+32, ME+32)
// RA <- r & m // RA <- r & m
Value* v = f.Truncate(f.LoadGPR(i.M.RT), INT32_TYPE); Value* v = f.Truncate(f.LoadGPR(i.M.RT), INT32_TYPE);
// TODO(benvanik): optimize srwi
// TODO(benvanik): optimize slwi
// The compiler will generate a bunch of these for the special case of SH=0. // The compiler will generate a bunch of these for the special case of SH=0.
// Which seems to just select some bits and set cr0 for use with a branch. // Which seems to just select some bits and set cr0 for use with a branch.
// We can detect this and do less work. // We can detect this and do less work.