mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-06-04 16:22:07 +00:00
Implement float comparison instruction.
This commit is contained in:
parent
e78e5b7534
commit
996fa013d0
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user