summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp23
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h6
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc2
3 files changed, 24 insertions, 7 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
895 } 895 }
896} 896}
897 897
898U1 IREmitter::FPIsNan(const F32& value) { 898U1 IREmitter::FPIsNan(const F16F32F64& value) {
899 return Inst<U1>(Opcode::FPIsNan32, value); 899 switch (value.Type()) {
900 case Type::F16:
901 return Inst<U1>(Opcode::FPIsNan16, value);
902 case Type::F32:
903 return Inst<U1>(Opcode::FPIsNan32, value);
904 case Type::F64:
905 return Inst<U1>(Opcode::FPIsNan64, value);
906 default:
907 ThrowInvalidType(value.Type());
908 }
900} 909}
901 910
902U1 IREmitter::FPOrdered(const F32& lhs, const F32& rhs) { 911U1 IREmitter::FPOrdered(const F16F32F64& lhs, const F16F32F64& rhs) {
912 if (lhs.Type() != rhs.Type()) {
913 throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type());
914 }
903 return LogicalAnd(LogicalNot(FPIsNan(lhs)), LogicalNot(FPIsNan(rhs))); 915 return LogicalAnd(LogicalNot(FPIsNan(lhs)), LogicalNot(FPIsNan(rhs)));
904} 916}
905 917
906U1 IREmitter::FPUnordered(const F32& lhs, const F32& rhs) { 918U1 IREmitter::FPUnordered(const F16F32F64& lhs, const F16F32F64& rhs) {
919 if (lhs.Type() != rhs.Type()) {
920 throw InvalidArgument("Mismatching types {} and {}", lhs.Type(), rhs.Type());
921 }
907 return LogicalOr(FPIsNan(lhs), FPIsNan(rhs)); 922 return LogicalOr(FPIsNan(lhs), FPIsNan(rhs));
908} 923}
909 924
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 8edb11154..ab4537d88 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -161,9 +161,9 @@ public:
161 FpControl control = {}, bool ordered = true); 161 FpControl control = {}, bool ordered = true);
162 [[nodiscard]] U1 FPGreaterThanEqual(const F16F32F64& lhs, const F16F32F64& rhs, 162 [[nodiscard]] U1 FPGreaterThanEqual(const F16F32F64& lhs, const F16F32F64& rhs,
163 FpControl control = {}, bool ordered = true); 163 FpControl control = {}, bool ordered = true);
164 [[nodiscard]] U1 FPIsNan(const F32& value); 164 [[nodiscard]] U1 FPIsNan(const F16F32F64& value);
165 [[nodiscard]] U1 FPOrdered(const F32& lhs, const F32& rhs); 165 [[nodiscard]] U1 FPOrdered(const F16F32F64& lhs, const F16F32F64& rhs);
166 [[nodiscard]] U1 FPUnordered(const F32& lhs, const F32& rhs); 166 [[nodiscard]] U1 FPUnordered(const F16F32F64& lhs, const F16F32F64& rhs);
167 [[nodiscard]] F32F64 FPMax(const F32F64& lhs, const F32F64& rhs, FpControl control = {}); 167 [[nodiscard]] F32F64 FPMax(const F32F64& lhs, const F32F64& rhs, FpControl control = {});
168 [[nodiscard]] F32F64 FPMin(const F32F64& lhs, const F32F64& rhs, FpControl control = {}); 168 [[nodiscard]] F32F64 FPMin(const F32F64& lhs, const F32F64& rhs, FpControl control = {});
169 169
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 8471db7b9..884eea7a8 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -236,7 +236,9 @@ OPCODE(FPOrdGreaterThanEqual64, U1, F64,
236OPCODE(FPUnordGreaterThanEqual16, U1, F16, F16, ) 236OPCODE(FPUnordGreaterThanEqual16, U1, F16, F16, )
237OPCODE(FPUnordGreaterThanEqual32, U1, F32, F32, ) 237OPCODE(FPUnordGreaterThanEqual32, U1, F32, F32, )
238OPCODE(FPUnordGreaterThanEqual64, U1, F64, F64, ) 238OPCODE(FPUnordGreaterThanEqual64, U1, F64, F64, )
239OPCODE(FPIsNan16, U1, F16, )
239OPCODE(FPIsNan32, U1, F32, ) 240OPCODE(FPIsNan32, U1, F32, )
241OPCODE(FPIsNan64, U1, F64, )
240 242
241// Integer operations 243// Integer operations
242OPCODE(IAdd32, U32, U32, U32, ) 244OPCODE(IAdd32, U32, U32, U32, )