diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-03-01 07:30:09 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:23 +0200 |
commit | e0389286165805258fa2e54014c2dc506ffb9f35 (patch) | |
tree | d7830153aac3a2ad93fd93f8b74516bbeb8f3718 /src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp | |
parent | shader: Make IMNMX, SHR, SEL stylistically more consistent (diff) | |
download | yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar.gz yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar.bz2 yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar.lz yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar.xz yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.tar.zst yuzu-e0389286165805258fa2e54014c2dc506ffb9f35.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp index 1f604b0ee..d844974d8 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_compare.cpp @@ -4,46 +4,11 @@ #include "common/bit_field.h" #include "common/common_types.h" +#include "shader_recompiler/frontend/maxwell/translate/impl/common_funcs.h" #include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" namespace Shader::Maxwell { namespace { -enum class ComparisonOp : u64 { - False, - LessThan, - Equal, - LessThanEqual, - GreaterThan, - NotEqual, - GreaterThanEqual, - True, -}; - -[[nodiscard]] IR::U1 CompareToZero(TranslatorVisitor& v, const IR::U32& operand, - ComparisonOp compare_op, bool is_signed) { - const IR::U32 zero{v.ir.Imm32(0)}; - switch (compare_op) { - case ComparisonOp::False: - return v.ir.Imm1(false); - case ComparisonOp::LessThan: - return v.ir.ILessThan(operand, zero, is_signed); - case ComparisonOp::Equal: - return v.ir.IEqual(operand, zero); - case ComparisonOp::LessThanEqual: - return v.ir.ILessThanEqual(operand, zero, is_signed); - case ComparisonOp::GreaterThan: - return v.ir.IGreaterThan(operand, zero, is_signed); - case ComparisonOp::NotEqual: - return v.ir.INotEqual(operand, zero); - case ComparisonOp::GreaterThanEqual: - return v.ir.IGreaterThanEqual(operand, zero, is_signed); - case ComparisonOp::True: - return v.ir.Imm1(true); - default: - throw NotImplementedException("ICMP.CMP"); - } -} - void ICMP(TranslatorVisitor& v, u64 insn, const IR::U32& src_a, const IR::U32& operand) { union { u64 insn; @@ -55,7 +20,7 @@ void ICMP(TranslatorVisitor& v, u64 insn, const IR::U32& src_a, const IR::U32& o const IR::U32 zero{v.ir.Imm32(0)}; const bool is_signed{icmp.is_signed != 0}; - const IR::U1 cmp_result{CompareToZero(v, operand, icmp.compare_op, is_signed)}; + const IR::U1 cmp_result{IntegerCompare(v, operand, zero, icmp.compare_op, is_signed)}; const IR::U32 src_reg{v.X(icmp.src_reg)}; const IR::U32 result{v.ir.Select(cmp_result, src_reg, src_a)}; |