mirror of
				https://github.com/hedge-dev/XenonRecomp.git
				synced 2025-11-04 06:47:09 +00:00 
			
		
		
		
	Implement float comparison instruction.
This commit is contained in:
		@@ -341,6 +341,7 @@ int main()
 | 
			
		||||
                    break;
 | 
			
		||||
 | 
			
		||||
                case PPC_INST_FCMPU:
 | 
			
		||||
                    std::println(f, "\tctx.cr{}.compare(ctx.f{}.f64, ctx.f{}.f64);", insn.operands[0], insn.operands[1], insn.operands[2]);
 | 
			
		||||
                    break;
 | 
			
		||||
 | 
			
		||||
                case PPC_INST_FCTID:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <cstdlib>
 | 
			
		||||
#include <cmath>
 | 
			
		||||
 | 
			
		||||
#ifdef __clang__
 | 
			
		||||
#include <x86intrin.h>
 | 
			
		||||
@@ -53,7 +54,11 @@ struct PPCCRRegister
 | 
			
		||||
    uint8_t lt;
 | 
			
		||||
    uint8_t gt;
 | 
			
		||||
    uint8_t eq;
 | 
			
		||||
    uint8_t so;
 | 
			
		||||
    union
 | 
			
		||||
    {
 | 
			
		||||
        uint8_t so;
 | 
			
		||||
        uint8_t un;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    template<typename T>
 | 
			
		||||
    void compare(T left, T right, const PPCXERRegister& xer)
 | 
			
		||||
@@ -63,6 +68,14 @@ struct PPCCRRegister
 | 
			
		||||
        eq = left == right;
 | 
			
		||||
        so = xer.so;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void compare(double left, double right)
 | 
			
		||||
    {
 | 
			
		||||
        lt = left < right;
 | 
			
		||||
        gt = left > right;
 | 
			
		||||
        eq = left == right;
 | 
			
		||||
        un = isnan(left) || isnan(right);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef float float128[4];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user