diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-03-21 04:42:56 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:24 +0200 |
commit | a77e764726938a26803fa90a9c69ccdd32ab09cd (patch) | |
tree | dbc22cd8ba43dbb8f6458dca40ad078e317eb755 /src/shader_recompiler/frontend/ir/ir_emitter.cpp | |
parent | shader: Fix floating point comparison for FP16 (diff) | |
download | yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.gz yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.bz2 yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.lz yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.xz yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.tar.zst yuzu-a77e764726938a26803fa90a9c69ccdd32ab09cd.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/ir/ir_emitter.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 652f6949e..1eda95071 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp @@ -895,15 +895,30 @@ U1 IREmitter::FPGreaterThanEqual(const F16F32F64& lhs, const F16F32F64& rhs, FpC } } -U1 IREmitter::FPIsNan(const F32& value) { - return Inst<U1>(Opcode::FPIsNan32, value); +U1 IREmitter::FPIsNan(const F16F32F64& value) { + switch (value.Type()) { + case Type::F16: + return Inst<U1>(Opcode::FPIsNan16, value); + case Type::F32: + return Inst<U1>(Opcode::FPIsNan32, value); + case Type::F64: + return Inst<U1>(Opcode::FPIsNan64, value); + default: + ThrowInvalidType(value.Type()); + } } -U1 IREmitter::FPOrdered(const F32& lhs, const F32& rhs) { +U1 IREmitter::FPOrdered(const F16F32F64& lhs, const F16F32F64& rhs) { + if (lhs.Type() != rhs.Type()) { + throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type()); + } return LogicalAnd(LogicalNot(FPIsNan(lhs)), LogicalNot(FPIsNan(rhs))); } -U1 IREmitter::FPUnordered(const F32& lhs, const F32& rhs) { +U1 IREmitter::FPUnordered(const F16F32F64& lhs, const F16F32F64& rhs) { + if (lhs.Type() != rhs.Type()) { + throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type()); + } return LogicalOr(FPIsNan(lhs), FPIsNan(rhs)); } |