mirror of
				https://github.com/hedge-dev/XenonRecomp.git
				synced 2025-11-04 06:47:09 +00:00 
			
		
		
		
	Define XER register.
This commit is contained in:
		@@ -233,14 +233,14 @@ int main()
 | 
				
			|||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                case PPC_INST_CMPLWI:
 | 
					                case PPC_INST_CMPLWI:
 | 
				
			||||||
                    std::println(f, "\tctx.cr{}.compare<uint32_t>(ctx.r{}.u32, {});", insn.operands[0], insn.operands[1], insn.operands[2]);
 | 
					                    std::println(f, "\tctx.cr{}.compare<uint32_t>(ctx.r{}.u32, {}, ctx.xer);", insn.operands[0], insn.operands[1], insn.operands[2]);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                case PPC_INST_CMPW:
 | 
					                case PPC_INST_CMPW:
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                case PPC_INST_CMPWI:
 | 
					                case PPC_INST_CMPWI:
 | 
				
			||||||
                    std::println(f, "\tctx.cr{}.compare<int32_t>(ctx.r{}.s32, {});", insn.operands[0], insn.operands[1], int32_t(insn.operands[2]));
 | 
					                    std::println(f, "\tctx.cr{}.compare<int32_t>(ctx.r{}.s32, {}, ctx.xer);", insn.operands[0], insn.operands[1], int32_t(insn.operands[2]));
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                case PPC_INST_CNTLZD:
 | 
					                case PPC_INST_CNTLZD:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,13 @@ struct PPCRegister
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct PPCXERRegister
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    uint8_t so;
 | 
				
			||||||
 | 
					    uint8_t ov;
 | 
				
			||||||
 | 
					    uint8_t ca;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct PPCCRRegister
 | 
					struct PPCCRRegister
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint8_t lt;
 | 
					    uint8_t lt;
 | 
				
			||||||
@@ -47,11 +54,12 @@ struct PPCCRRegister
 | 
				
			|||||||
    uint8_t so;
 | 
					    uint8_t so;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    void compare(T left, T right)
 | 
					    void compare(T left, T right, const PPCXERRegister& xer)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        lt = left < right;
 | 
					        lt = left < right;
 | 
				
			||||||
        gt = left > right;
 | 
					        gt = left > right;
 | 
				
			||||||
        eq = left == right;
 | 
					        eq = left == right;
 | 
				
			||||||
 | 
					        so = xer.so;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -61,6 +69,7 @@ struct PPCContext
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    uint64_t lr;
 | 
					    uint64_t lr;
 | 
				
			||||||
    uint64_t ctr;
 | 
					    uint64_t ctr;
 | 
				
			||||||
 | 
					    PPCXERRegister xer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    union
 | 
					    union
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user