mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-24 12:25:00 +00:00
Added Legacy Min/Max ops (#266)
* Forwarding V_MAX_LEGACY_F32 to V_MAX3_F32. Fixes Translation error in Geometry Wars 3. * Forwarded to correct op * Implemented Legacy Max/Min using NMax/NMin * Added extra argument to Min/Max op codes * Removed extra translator functions, replaced with bool * Formatting
This commit is contained in:
parent
550e05b3ca
commit
2620919f0b
8 changed files with 39 additions and 18 deletions
|
@ -865,28 +865,35 @@ U1 IREmitter::FPUnordered(const F32F64& lhs, const F32F64& rhs) {
|
|||
return LogicalOr(FPIsNan(lhs), FPIsNan(rhs));
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPMax(const F32F64& lhs, const F32F64& rhs) {
|
||||
F32F64 IREmitter::FPMax(const F32F64& lhs, const F32F64& rhs, bool is_legacy) {
|
||||
if (lhs.Type() != rhs.Type()) {
|
||||
UNREACHABLE_MSG("Mismatching types {} and {}", lhs.Type(), rhs.Type());
|
||||
}
|
||||
|
||||
switch (lhs.Type()) {
|
||||
case Type::F32:
|
||||
return Inst<F32>(Opcode::FPMax32, lhs, rhs);
|
||||
return Inst<F32>(Opcode::FPMax32, lhs, rhs, is_legacy);
|
||||
case Type::F64:
|
||||
if (is_legacy) {
|
||||
UNREACHABLE_MSG("F64 cannot be used with LEGACY ops");
|
||||
}
|
||||
return Inst<F64>(Opcode::FPMax64, lhs, rhs);
|
||||
default:
|
||||
ThrowInvalidType(lhs.Type());
|
||||
}
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPMin(const F32F64& lhs, const F32F64& rhs) {
|
||||
F32F64 IREmitter::FPMin(const F32F64& lhs, const F32F64& rhs, bool is_legacy) {
|
||||
if (lhs.Type() != rhs.Type()) {
|
||||
UNREACHABLE_MSG("Mismatching types {} and {}", lhs.Type(), rhs.Type());
|
||||
}
|
||||
switch (lhs.Type()) {
|
||||
case Type::F32:
|
||||
return Inst<F32>(Opcode::FPMin32, lhs, rhs);
|
||||
return Inst<F32>(Opcode::FPMin32, lhs, rhs, is_legacy);
|
||||
case Type::F64:
|
||||
if (is_legacy) {
|
||||
UNREACHABLE_MSG("F64 cannot be used with LEGACY ops");
|
||||
}
|
||||
return Inst<F64>(Opcode::FPMin64, lhs, rhs);
|
||||
default:
|
||||
ThrowInvalidType(lhs.Type());
|
||||
|
|
|
@ -149,8 +149,8 @@ public:
|
|||
[[nodiscard]] U1 FPIsInf(const F32F64& value);
|
||||
[[nodiscard]] U1 FPOrdered(const F32F64& lhs, const F32F64& rhs);
|
||||
[[nodiscard]] U1 FPUnordered(const F32F64& lhs, const F32F64& rhs);
|
||||
[[nodiscard]] F32F64 FPMax(const F32F64& lhs, const F32F64& rhs);
|
||||
[[nodiscard]] F32F64 FPMin(const F32F64& lhs, const F32F64& rhs);
|
||||
[[nodiscard]] F32F64 FPMax(const F32F64& lhs, const F32F64& rhs, bool is_legacy = false);
|
||||
[[nodiscard]] F32F64 FPMin(const F32F64& lhs, const F32F64& rhs, bool is_legacy = false);
|
||||
|
||||
[[nodiscard]] U32U64 IAdd(const U32U64& a, const U32U64& b);
|
||||
[[nodiscard]] Value IAddCary(const U32& a, const U32& b);
|
||||
|
|
|
@ -154,9 +154,9 @@ OPCODE(FPAdd64, F64, F64,
|
|||
OPCODE(FPSub32, F32, F32, F32, )
|
||||
OPCODE(FPFma32, F32, F32, F32, F32, )
|
||||
OPCODE(FPFma64, F64, F64, F64, F64, )
|
||||
OPCODE(FPMax32, F32, F32, F32, )
|
||||
OPCODE(FPMax32, F32, F32, F32, U1, )
|
||||
OPCODE(FPMax64, F64, F64, F64, )
|
||||
OPCODE(FPMin32, F32, F32, F32, )
|
||||
OPCODE(FPMin32, F32, F32, F32, U1, )
|
||||
OPCODE(FPMin64, F64, F64, F64, )
|
||||
OPCODE(FPMul32, F32, F32, F32, )
|
||||
OPCODE(FPMul64, F64, F64, F64, )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue