summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp21
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h2
2 files changed, 13 insertions, 10 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index 82613f607..6d41442ee 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -1121,6 +1121,10 @@ U32 IREmitter::UMin(const U32& a, const U32& b) {
1121 return Inst<U32>(Opcode::UMin32, a, b); 1121 return Inst<U32>(Opcode::UMin32, a, b);
1122} 1122}
1123 1123
1124U32 IREmitter::IMin(const U32& a, const U32& b, bool is_signed) {
1125 return is_signed ? SMin(a, b) : UMin(a, b);
1126}
1127
1124U32 IREmitter::SMax(const U32& a, const U32& b) { 1128U32 IREmitter::SMax(const U32& a, const U32& b) {
1125 return Inst<U32>(Opcode::SMax32, a, b); 1129 return Inst<U32>(Opcode::SMax32, a, b);
1126} 1130}
@@ -1129,6 +1133,10 @@ U32 IREmitter::UMax(const U32& a, const U32& b) {
1129 return Inst<U32>(Opcode::UMax32, a, b); 1133 return Inst<U32>(Opcode::UMax32, a, b);
1130} 1134}
1131 1135
1136U32 IREmitter::IMax(const U32& a, const U32& b, bool is_signed) {
1137 return is_signed ? SMax(a, b) : UMax(a, b);
1138}
1139
1132U1 IREmitter::ILessThan(const U32& lhs, const U32& rhs, bool is_signed) { 1140U1 IREmitter::ILessThan(const U32& lhs, const U32& rhs, bool is_signed) {
1133 return Inst<U1>(is_signed ? Opcode::SLessThan : Opcode::ULessThan, lhs, rhs); 1141 return Inst<U1>(is_signed ? Opcode::SLessThan : Opcode::ULessThan, lhs, rhs);
1134} 1142}
@@ -1267,11 +1275,7 @@ U32U64 IREmitter::ConvertFToU(size_t bitsize, const F16F32F64& value) {
1267} 1275}
1268 1276
1269U32U64 IREmitter::ConvertFToI(size_t bitsize, bool is_signed, const F16F32F64& value) { 1277U32U64 IREmitter::ConvertFToI(size_t bitsize, bool is_signed, const F16F32F64& value) {
1270 if (is_signed) { 1278 return is_signed ? ConvertFToS(bitsize, value) : ConvertFToU(bitsize, value);
1271 return ConvertFToS(bitsize, value);
1272 } else {
1273 return ConvertFToU(bitsize, value);
1274 }
1275} 1279}
1276 1280
1277F16F32F64 IREmitter::ConvertSToF(size_t dest_bitsize, size_t src_bitsize, const Value& value) { 1281F16F32F64 IREmitter::ConvertSToF(size_t dest_bitsize, size_t src_bitsize, const Value& value) {
@@ -1360,11 +1364,8 @@ F16F32F64 IREmitter::ConvertUToF(size_t dest_bitsize, size_t src_bitsize, const
1360 1364
1361F16F32F64 IREmitter::ConvertIToF(size_t dest_bitsize, size_t src_bitsize, bool is_signed, 1365F16F32F64 IREmitter::ConvertIToF(size_t dest_bitsize, size_t src_bitsize, bool is_signed,
1362 const Value& value) { 1366 const Value& value) {
1363 if (is_signed) { 1367 return is_signed ? ConvertSToF(dest_bitsize, src_bitsize, value)
1364 return ConvertSToF(dest_bitsize, src_bitsize, value); 1368 : ConvertUToF(dest_bitsize, src_bitsize, value);
1365 } else {
1366 return ConvertUToF(dest_bitsize, src_bitsize, value);
1367 }
1368} 1369}
1369 1370
1370U32U64 IREmitter::UConvert(size_t result_bitsize, const U32U64& value) { 1371U32U64 IREmitter::UConvert(size_t result_bitsize, const U32U64& value) {
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 771c186d4..8d50aa607 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -196,8 +196,10 @@ public:
196 [[nodiscard]] U32 FindUMsb(const U32& value); 196 [[nodiscard]] U32 FindUMsb(const U32& value);
197 [[nodiscard]] U32 SMin(const U32& a, const U32& b); 197 [[nodiscard]] U32 SMin(const U32& a, const U32& b);
198 [[nodiscard]] U32 UMin(const U32& a, const U32& b); 198 [[nodiscard]] U32 UMin(const U32& a, const U32& b);
199 [[nodiscard]] U32 IMin(const U32& a, const U32& b, bool is_signed);
199 [[nodiscard]] U32 SMax(const U32& a, const U32& b); 200 [[nodiscard]] U32 SMax(const U32& a, const U32& b);
200 [[nodiscard]] U32 UMax(const U32& a, const U32& b); 201 [[nodiscard]] U32 UMax(const U32& a, const U32& b);
202 [[nodiscard]] U32 IMax(const U32& a, const U32& b, bool is_signed);
201 203
202 [[nodiscard]] U1 ILessThan(const U32& lhs, const U32& rhs, bool is_signed); 204 [[nodiscard]] U1 ILessThan(const U32& lhs, const U32& rhs, bool is_signed);
203 [[nodiscard]] U1 IEqual(const U32U64& lhs, const U32U64& rhs); 205 [[nodiscard]] U1 IEqual(const U32U64& lhs, const U32U64& rhs);