mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-06-23 16:05:30 +00:00
Handle "r0 as 0" cases.
This commit is contained in:
parent
df78800c8d
commit
26122def54
@ -190,7 +190,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_ADDI:
|
case PPC_INST_ADDI:
|
||||||
println("\tctx.r{}.s64 = ctx.r{}.s64 + {};", insn.operands[0], insn.operands[1], static_cast<int32_t>(insn.operands[2]));
|
print("\tctx.r{}.s64 = ", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.s64 + ", insn.operands[1]);
|
||||||
|
println("{};", static_cast<int32_t>(insn.operands[2]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_ADDIC:
|
case PPC_INST_ADDIC:
|
||||||
@ -200,7 +203,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_ADDIS:
|
case PPC_INST_ADDIS:
|
||||||
println("\tctx.r{}.s64 = ctx.r{}.s64 + {};", insn.operands[0], insn.operands[1], static_cast<int32_t>(insn.operands[2] << 16));
|
print("\tctx.r{}.s64 = ", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.s64 + ", insn.operands[1]);
|
||||||
|
println("{};", static_cast<int32_t>(insn.operands[2] << 16));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_ADDZE:
|
case PPC_INST_ADDZE:
|
||||||
@ -264,6 +270,8 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BDNZF:
|
case PPC_INST_BDNZF:
|
||||||
|
// NOTE: assuming eq here as a shortcut because all the instructions in the game do that
|
||||||
|
println("\tif (--ctx.ctr != 0 && !ctx.cr{}.eq) goto loc_{:X};", insn.operands[0], insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BEQ:
|
case PPC_INST_BEQ:
|
||||||
@ -308,6 +316,7 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BLRL:
|
case PPC_INST_BLRL:
|
||||||
|
println("\tctx.fn[ctx.lr / 4](ctx, base);");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BLT:
|
case PPC_INST_BLT:
|
||||||
@ -323,6 +332,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BNECTR:
|
case PPC_INST_BNECTR:
|
||||||
|
println("\tif (!ctx.cr{}.eq) {{", insn.operands[0]);
|
||||||
|
println("\t\tctx.fn[ctx.ctr / 4](ctx, base);");
|
||||||
|
println("\t\treturn;");
|
||||||
|
println("\t}}");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_BNELR:
|
case PPC_INST_BNELR:
|
||||||
@ -402,10 +415,26 @@ int main()
|
|||||||
case PPC_INST_DCBTST:
|
case PPC_INST_DCBTST:
|
||||||
case PPC_INST_DCBZ:
|
case PPC_INST_DCBZ:
|
||||||
case PPC_INST_DCBZL:
|
case PPC_INST_DCBZL:
|
||||||
|
break;
|
||||||
|
|
||||||
case PPC_INST_DIVD:
|
case PPC_INST_DIVD:
|
||||||
|
println("\tctx.r{}.s64 = ctx.r{}.s64 / ctx.r{}.s64;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
|
break;
|
||||||
|
|
||||||
case PPC_INST_DIVDU:
|
case PPC_INST_DIVDU:
|
||||||
|
println("\tctx.r{}.u64 = ctx.r{}.u64 / ctx.r{}.u64;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
|
break;
|
||||||
|
|
||||||
case PPC_INST_DIVW:
|
case PPC_INST_DIVW:
|
||||||
|
println("\tctx.r{}.s32 = ctx.r{}.s32 / ctx.r{}.s32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
|
if (insn.opcode->opcode & 0x1)
|
||||||
|
println("\tctx.cr0.compare<int32_t>(ctx.r{}.s32, 0, ctx.xer);", insn.operands[0]);
|
||||||
|
break;
|
||||||
|
|
||||||
case PPC_INST_DIVWU:
|
case PPC_INST_DIVWU:
|
||||||
|
println("\tctx.r{}.u32 = ctx.r{}.u32 / ctx.r{}.u32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
|
if (insn.opcode->opcode & 0x1)
|
||||||
|
println("\tctx.cr0.compare<int32_t>(ctx.r{}.s32, 0, ctx.xer);", insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_EIEIO:
|
case PPC_INST_EIEIO:
|
||||||
@ -548,7 +577,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LBZ:
|
case PPC_INST_LBZ:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U8({} + ctx.r{}.u32);", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U8(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LBZU:
|
case PPC_INST_LBZU:
|
||||||
@ -558,11 +590,17 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LBZX:
|
case PPC_INST_LBZX:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U8(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U8(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LD:
|
case PPC_INST_LD:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U64({} + ctx.r{}.u32);", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U64(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LDARX:
|
case PPC_INST_LDARX:
|
||||||
@ -575,50 +613,75 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LDX:
|
case PPC_INST_LDX:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U64(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U64(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LFD:
|
case PPC_INST_LFD:
|
||||||
println("\tctx.f{}.u64 = PPC_LOAD_U64({} + ctx.r{}.u32);", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.f{}.u64 = PPC_LOAD_U64(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LFDX:
|
case PPC_INST_LFDX:
|
||||||
println("\tctx.f{}.u64 = PPC_LOAD_U64(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.f{}.u64 = PPC_LOAD_U64(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LFS:
|
case PPC_INST_LFS:
|
||||||
println("\ttemp.u32 = PPC_LOAD_U32({} + ctx.r{}.u32);", int32_t(insn.operands[1]), insn.operands[2]);
|
print("\ttemp.u32 = PPC_LOAD_U32(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
println("\tctx.f{}.f64 = temp.f32;", insn.operands[0]);
|
println("\tctx.f{}.f64 = temp.f32;", insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LFSX:
|
case PPC_INST_LFSX:
|
||||||
println("\ttemp.u32 = PPC_LOAD_U32(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[1], insn.operands[2]);
|
print("\ttemp.u32 = PPC_LOAD_U32(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
println("\tctx.f{}.f64 = temp.f32;", insn.operands[0]);
|
println("\tctx.f{}.f64 = temp.f32;", insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LHA:
|
case PPC_INST_LHA:
|
||||||
println("\tctx.r{}.s64 = int16_t(PPC_LOAD_U16({} + ctx.r{}.u32));", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.s64 = int16_t(PPC_LOAD_U16(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}));", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LHAX:
|
case PPC_INST_LHAX:
|
||||||
println("\tctx.r{}.s64 = int16_t(PPC_LOAD_U16(ctx.r{}.u32 + ctx.r{}.u32));", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.s64 = int16_t(PPC_LOAD_U16(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32));", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LHZ:
|
case PPC_INST_LHZ:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U16({} + ctx.r{}.u32);", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U16(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LHZX:
|
case PPC_INST_LHZX:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U16(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U16(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LI:
|
case PPC_INST_LI:
|
||||||
// TODO: validate the sign extend
|
|
||||||
println("\tctx.r{}.s64 = {};", insn.operands[0], int32_t(insn.operands[1]));
|
println("\tctx.r{}.s64 = {};", insn.operands[0], int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LIS:
|
case PPC_INST_LIS:
|
||||||
// TODO: validate the sign extend
|
|
||||||
println("\tctx.r{}.s64 = {};", insn.operands[0], int32_t(insn.operands[1] << 16));
|
println("\tctx.r{}.s64 = {};", insn.operands[0], int32_t(insn.operands[1] << 16));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -635,18 +698,27 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWA:
|
case PPC_INST_LWA:
|
||||||
println("\tctx.r{}.s64 = int32_t(PPC_LOAD_U32({} + ctx.r{}.u32));", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.s64 = int32_t(PPC_LOAD_U32(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}));", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWARX:
|
case PPC_INST_LWARX:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWAX:
|
case PPC_INST_LWAX:
|
||||||
println("\tctx.r{}.s64 = int32_t(PPC_LOAD_U32(ctx.r{}.u32 + ctx.r{}.u32));", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.s64 = int32_t(PPC_LOAD_U32(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32));", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWBRX:
|
case PPC_INST_LWBRX:
|
||||||
println("\tctx.r{}.u64 = _byteswap_ulong(PPC_LOAD_U32(ctx.r{}.u32 + ctx.r{}.u32));", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.u64 = _byteswap_ulong(PPC_LOAD_U32(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32));", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWSYNC:
|
case PPC_INST_LWSYNC:
|
||||||
@ -654,7 +726,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWZ:
|
case PPC_INST_LWZ:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U32({} + ctx.r{}.u32);", insn.operands[0], int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U32(", insn.operands[0]);
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{});", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWZU:
|
case PPC_INST_LWZU:
|
||||||
@ -664,7 +739,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_LWZX:
|
case PPC_INST_LWZX:
|
||||||
println("\tctx.r{}.u64 = PPC_LOAD_U32(ctx.r{}.u32 + ctx.r{}.u32);", insn.operands[0], insn.operands[1], insn.operands[2]);
|
print("\tctx.r{}.u64 = PPC_LOAD_U32(", insn.operands[0]);
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_MFCR:
|
case PPC_INST_MFCR:
|
||||||
@ -707,12 +785,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_MULHW:
|
case PPC_INST_MULHW:
|
||||||
// TODO: might be having 32 bit truncation here
|
|
||||||
println("\tctx.r{}.s64 = int64_t(ctx.r{}.s32 * ctx.r{}.s32) << 32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
println("\tctx.r{}.s64 = int64_t(ctx.r{}.s32 * ctx.r{}.s32) << 32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_MULHWU:
|
case PPC_INST_MULHWU:
|
||||||
// TODO: might be having 32 bit truncation here
|
|
||||||
println("\tctx.r{}.u64 = uint64_t(ctx.r{}.u32 * ctx.r{}.u32) << 32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
println("\tctx.r{}.u64 = uint64_t(ctx.r{}.u32 * ctx.r{}.u32) << 32;", insn.operands[0], insn.operands[1], insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -791,7 +867,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STB:
|
case PPC_INST_STB:
|
||||||
println("\tPPC_STORE_U8({} + ctx.r{}.u32, ctx.r{}.u8);", int32_t(insn.operands[1]), insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U8(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}, ctx.r{}.u8);", int32_t(insn.operands[1]), insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STBU:
|
case PPC_INST_STBU:
|
||||||
@ -801,11 +880,17 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STBX:
|
case PPC_INST_STBX:
|
||||||
println("\tPPC_STORE_U8(ctx.r{}.u32 + ctx.r{}.u32, ctx.r{}.u8);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U8(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.r{}.u8);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STD:
|
case PPC_INST_STD:
|
||||||
println("\tPPC_STORE_U64({} + ctx.r{}.u32, ctx.r{}.u64);", int32_t(insn.operands[1]), insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U64(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}, ctx.r{}.u64);", int32_t(insn.operands[1]), insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STDCX:
|
case PPC_INST_STDCX:
|
||||||
@ -818,41 +903,68 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STDX:
|
case PPC_INST_STDX:
|
||||||
println("\tPPC_STORE_U64(ctx.r{}.u32 + ctx.r{}.u32, ctx.r{}.u64);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U64(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.r{}.u64);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STFD:
|
case PPC_INST_STFD:
|
||||||
println("\tPPC_STORE_U64({} + ctx.r{}.u32, ctx.f{}.u64);", int32_t(insn.operands[1]), insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U64(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}, ctx.f{}.u64);", int32_t(insn.operands[1]), insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STFDX:
|
case PPC_INST_STFDX:
|
||||||
println("\tPPC_STORE_U64(ctx.r{}.u32 + ctx.r{}.u32, ctx.f{}.u64);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U64(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.f{}.u64);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STFIWX:
|
case PPC_INST_STFIWX:
|
||||||
println("\tPPC_STORE_U32(ctx.r{}.u32 + ctx.r{}.u32, ctx.f{}.u32);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.f{}.u32);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STFS:
|
case PPC_INST_STFS:
|
||||||
println("\ttemp.f32 = ctx.f{}.f64;", insn.operands[0]);
|
println("\ttemp.f32 = ctx.f{}.f64;", insn.operands[0]);
|
||||||
println("\tPPC_STORE_U32({} + ctx.r{}.u32, temp.u32);", int32_t(insn.operands[1]), insn.operands[2]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 +", insn.operands[2]);
|
||||||
|
println("{}, temp.u32);", int32_t(insn.operands[1]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STFSX:
|
case PPC_INST_STFSX:
|
||||||
println("\ttemp.f32 = ctx.f{}.f64;", insn.operands[0]);
|
println("\ttemp.f32 = ctx.f{}.f64;", insn.operands[0]);
|
||||||
println("\tPPC_STORE_U32(ctx.r{}.u32 + ctx.r{}.u32, temp.u32);", insn.operands[1], insn.operands[2]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, temp.u32);", insn.operands[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STH:
|
case PPC_INST_STH:
|
||||||
println("\tPPC_STORE_U16({} + ctx.r{}.u32, ctx.r{}.u16);", int32_t(insn.operands[1]), insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U16(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}, ctx.r{}.u16);", int32_t(insn.operands[1]), insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STHBRX:
|
case PPC_INST_STHBRX:
|
||||||
println("\tPPC_STORE_U16(ctx.r{}.u32 + ctx.r{}.u32, _byteswap_ushort(ctx.r{}.u16));", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U16(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, _byteswap_ushort(ctx.r{}.u16));", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STHX:
|
case PPC_INST_STHX:
|
||||||
println("\tPPC_STORE_U16(ctx.r{}.u32 + ctx.r{}.u32, ctx.r{}.u16);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U16(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.r{}.u16);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STVEHX:
|
case PPC_INST_STVEHX:
|
||||||
@ -867,11 +979,17 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STW:
|
case PPC_INST_STW:
|
||||||
println("\tPPC_STORE_U32({} + ctx.r{}.u32, ctx.r{}.u32);", int32_t(insn.operands[1]), insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[2] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[2]);
|
||||||
|
println("{}, ctx.r{}.u32);", int32_t(insn.operands[1]), insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STWBRX:
|
case PPC_INST_STWBRX:
|
||||||
println("\tPPC_STORE_U32(ctx.r{}.u32 + ctx.r{}.u32, _byteswap_ulong(ctx.r{}.u32));", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, _byteswap_ulong(ctx.r{}.u32));", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STWCX:
|
case PPC_INST_STWCX:
|
||||||
@ -890,7 +1008,10 @@ int main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_STWX:
|
case PPC_INST_STWX:
|
||||||
println("\tPPC_STORE_U32(ctx.r{}.u32 + ctx.r{}.u32, ctx.r{}.u32);", insn.operands[1], insn.operands[2], insn.operands[0]);
|
print("\tPPC_STORE_U32(");
|
||||||
|
if (insn.operands[1] != 0)
|
||||||
|
print("ctx.r{}.u32 + ", insn.operands[1]);
|
||||||
|
println("ctx.r{}.u32, ctx.r{}.u32);", insn.operands[2], insn.operands[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPC_INST_SUBF:
|
case PPC_INST_SUBF:
|
||||||
|
@ -81,7 +81,22 @@ struct PPCCRRegister
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef float float128[4];
|
struct alignas(0x10) PPCVRegister
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
int8_t s8[16];
|
||||||
|
uint8_t u8[16];
|
||||||
|
int16_t s16[8];
|
||||||
|
uint16_t u16[8];
|
||||||
|
int32_t s32[4];
|
||||||
|
uint32_t u32[4];
|
||||||
|
int64_t s64[2];
|
||||||
|
uint64_t u64[2];
|
||||||
|
float f32[4];
|
||||||
|
double f64[2];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
struct PPCContext
|
struct PPCContext
|
||||||
{
|
{
|
||||||
@ -190,135 +205,135 @@ struct PPCContext
|
|||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
float128 v0;
|
PPCVRegister v0;
|
||||||
float128 v1;
|
PPCVRegister v1;
|
||||||
float128 v2;
|
PPCVRegister v2;
|
||||||
float128 v3;
|
PPCVRegister v3;
|
||||||
float128 v4;
|
PPCVRegister v4;
|
||||||
float128 v5;
|
PPCVRegister v5;
|
||||||
float128 v6;
|
PPCVRegister v6;
|
||||||
float128 v7;
|
PPCVRegister v7;
|
||||||
float128 v8;
|
PPCVRegister v8;
|
||||||
float128 v9;
|
PPCVRegister v9;
|
||||||
float128 v10;
|
PPCVRegister v10;
|
||||||
float128 v11;
|
PPCVRegister v11;
|
||||||
float128 v12;
|
PPCVRegister v12;
|
||||||
float128 v13;
|
PPCVRegister v13;
|
||||||
float128 v14;
|
PPCVRegister v14;
|
||||||
float128 v15;
|
PPCVRegister v15;
|
||||||
float128 v16;
|
PPCVRegister v16;
|
||||||
float128 v17;
|
PPCVRegister v17;
|
||||||
float128 v18;
|
PPCVRegister v18;
|
||||||
float128 v19;
|
PPCVRegister v19;
|
||||||
float128 v20;
|
PPCVRegister v20;
|
||||||
float128 v21;
|
PPCVRegister v21;
|
||||||
float128 v22;
|
PPCVRegister v22;
|
||||||
float128 v23;
|
PPCVRegister v23;
|
||||||
float128 v24;
|
PPCVRegister v24;
|
||||||
float128 v25;
|
PPCVRegister v25;
|
||||||
float128 v26;
|
PPCVRegister v26;
|
||||||
float128 v27;
|
PPCVRegister v27;
|
||||||
float128 v28;
|
PPCVRegister v28;
|
||||||
float128 v29;
|
PPCVRegister v29;
|
||||||
float128 v30;
|
PPCVRegister v30;
|
||||||
float128 v31;
|
PPCVRegister v31;
|
||||||
float128 v32;
|
PPCVRegister v32;
|
||||||
float128 v33;
|
PPCVRegister v33;
|
||||||
float128 v34;
|
PPCVRegister v34;
|
||||||
float128 v35;
|
PPCVRegister v35;
|
||||||
float128 v36;
|
PPCVRegister v36;
|
||||||
float128 v37;
|
PPCVRegister v37;
|
||||||
float128 v38;
|
PPCVRegister v38;
|
||||||
float128 v39;
|
PPCVRegister v39;
|
||||||
float128 v40;
|
PPCVRegister v40;
|
||||||
float128 v41;
|
PPCVRegister v41;
|
||||||
float128 v42;
|
PPCVRegister v42;
|
||||||
float128 v43;
|
PPCVRegister v43;
|
||||||
float128 v44;
|
PPCVRegister v44;
|
||||||
float128 v45;
|
PPCVRegister v45;
|
||||||
float128 v46;
|
PPCVRegister v46;
|
||||||
float128 v47;
|
PPCVRegister v47;
|
||||||
float128 v48;
|
PPCVRegister v48;
|
||||||
float128 v49;
|
PPCVRegister v49;
|
||||||
float128 v50;
|
PPCVRegister v50;
|
||||||
float128 v51;
|
PPCVRegister v51;
|
||||||
float128 v52;
|
PPCVRegister v52;
|
||||||
float128 v53;
|
PPCVRegister v53;
|
||||||
float128 v54;
|
PPCVRegister v54;
|
||||||
float128 v55;
|
PPCVRegister v55;
|
||||||
float128 v56;
|
PPCVRegister v56;
|
||||||
float128 v57;
|
PPCVRegister v57;
|
||||||
float128 v58;
|
PPCVRegister v58;
|
||||||
float128 v59;
|
PPCVRegister v59;
|
||||||
float128 v60;
|
PPCVRegister v60;
|
||||||
float128 v61;
|
PPCVRegister v61;
|
||||||
float128 v62;
|
PPCVRegister v62;
|
||||||
float128 v63;
|
PPCVRegister v63;
|
||||||
float128 v64;
|
PPCVRegister v64;
|
||||||
float128 v65;
|
PPCVRegister v65;
|
||||||
float128 v66;
|
PPCVRegister v66;
|
||||||
float128 v67;
|
PPCVRegister v67;
|
||||||
float128 v68;
|
PPCVRegister v68;
|
||||||
float128 v69;
|
PPCVRegister v69;
|
||||||
float128 v70;
|
PPCVRegister v70;
|
||||||
float128 v71;
|
PPCVRegister v71;
|
||||||
float128 v72;
|
PPCVRegister v72;
|
||||||
float128 v73;
|
PPCVRegister v73;
|
||||||
float128 v74;
|
PPCVRegister v74;
|
||||||
float128 v75;
|
PPCVRegister v75;
|
||||||
float128 v76;
|
PPCVRegister v76;
|
||||||
float128 v77;
|
PPCVRegister v77;
|
||||||
float128 v78;
|
PPCVRegister v78;
|
||||||
float128 v79;
|
PPCVRegister v79;
|
||||||
float128 v80;
|
PPCVRegister v80;
|
||||||
float128 v81;
|
PPCVRegister v81;
|
||||||
float128 v82;
|
PPCVRegister v82;
|
||||||
float128 v83;
|
PPCVRegister v83;
|
||||||
float128 v84;
|
PPCVRegister v84;
|
||||||
float128 v85;
|
PPCVRegister v85;
|
||||||
float128 v86;
|
PPCVRegister v86;
|
||||||
float128 v87;
|
PPCVRegister v87;
|
||||||
float128 v88;
|
PPCVRegister v88;
|
||||||
float128 v89;
|
PPCVRegister v89;
|
||||||
float128 v90;
|
PPCVRegister v90;
|
||||||
float128 v91;
|
PPCVRegister v91;
|
||||||
float128 v92;
|
PPCVRegister v92;
|
||||||
float128 v93;
|
PPCVRegister v93;
|
||||||
float128 v94;
|
PPCVRegister v94;
|
||||||
float128 v95;
|
PPCVRegister v95;
|
||||||
float128 v96;
|
PPCVRegister v96;
|
||||||
float128 v97;
|
PPCVRegister v97;
|
||||||
float128 v98;
|
PPCVRegister v98;
|
||||||
float128 v99;
|
PPCVRegister v99;
|
||||||
float128 v100;
|
PPCVRegister v100;
|
||||||
float128 v101;
|
PPCVRegister v101;
|
||||||
float128 v102;
|
PPCVRegister v102;
|
||||||
float128 v103;
|
PPCVRegister v103;
|
||||||
float128 v104;
|
PPCVRegister v104;
|
||||||
float128 v105;
|
PPCVRegister v105;
|
||||||
float128 v106;
|
PPCVRegister v106;
|
||||||
float128 v107;
|
PPCVRegister v107;
|
||||||
float128 v108;
|
PPCVRegister v108;
|
||||||
float128 v109;
|
PPCVRegister v109;
|
||||||
float128 v110;
|
PPCVRegister v110;
|
||||||
float128 v111;
|
PPCVRegister v111;
|
||||||
float128 v112;
|
PPCVRegister v112;
|
||||||
float128 v113;
|
PPCVRegister v113;
|
||||||
float128 v114;
|
PPCVRegister v114;
|
||||||
float128 v115;
|
PPCVRegister v115;
|
||||||
float128 v116;
|
PPCVRegister v116;
|
||||||
float128 v117;
|
PPCVRegister v117;
|
||||||
float128 v118;
|
PPCVRegister v118;
|
||||||
float128 v119;
|
PPCVRegister v119;
|
||||||
float128 v120;
|
PPCVRegister v120;
|
||||||
float128 v121;
|
PPCVRegister v121;
|
||||||
float128 v122;
|
PPCVRegister v122;
|
||||||
float128 v123;
|
PPCVRegister v123;
|
||||||
float128 v124;
|
PPCVRegister v124;
|
||||||
float128 v125;
|
PPCVRegister v125;
|
||||||
float128 v126;
|
PPCVRegister v126;
|
||||||
float128 v127;
|
PPCVRegister v127;
|
||||||
};
|
};
|
||||||
float128 v[128];
|
PPCVRegister v[128];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user