diff --git a/src/shader_recompiler/frontend/translate/scalar_alu.cpp b/src/shader_recompiler/frontend/translate/scalar_alu.cpp index 22c00e890..7678374bd 100644 --- a/src/shader_recompiler/frontend/translate/scalar_alu.cpp +++ b/src/shader_recompiler/frontend/translate/scalar_alu.cpp @@ -292,14 +292,12 @@ void Translator::S_ADDC_U32(const GcnInst& inst) { const IR::U32 src0{GetSrc(inst.src[0])}; const IR::U32 src1{GetSrc(inst.src[1])}; const IR::U32 carry{ir.Select(ir.GetScc(), ir.Imm32(1U), ir.Imm32(0U))}; - const IR::Value tmp1{ir.IAddCarry(src0, src1)}; - const IR::U32 result1{ir.CompositeExtract(tmp1, 0)}; - const IR::U32 carry_out1{ir.CompositeExtract(tmp1, 1)}; - const IR::Value tmp2{ir.IAddCarry(result1, carry)}; - const IR::U32 result2{ir.CompositeExtract(tmp2, 0)}; - const IR::U32 carry_out2{ir.CompositeExtract(tmp2, 1)}; + const IR::U32 result1{ir.IAdd(src0, src1)}; + const IR::U32 result2{ir.IAdd(result1, carry)}; + const IR::U1 carry_out1{ir.ILessThan(result1, src0, false)}; + const IR::U1 carry_out2{ir.ILessThan(result2, result1, false)}; SetDst(inst.dst[0], result2); - ir.SetScc(ir.INotEqual(ir.BitwiseOr(carry_out1, carry_out2), ir.Imm32(0))); + ir.SetScc(ir.LogicalOr(carry_out1, carry_out2)); } void Translator::S_MIN_U32(bool is_signed, const GcnInst& inst) { diff --git a/src/shader_recompiler/frontend/translate/vector_alu.cpp b/src/shader_recompiler/frontend/translate/vector_alu.cpp index 398a4929b..6a38fa828 100644 --- a/src/shader_recompiler/frontend/translate/vector_alu.cpp +++ b/src/shader_recompiler/frontend/translate/vector_alu.cpp @@ -786,19 +786,16 @@ void Translator::V_SUBREV_I32(const GcnInst& inst) { } void Translator::V_ADDC_U32(const GcnInst& inst) { - // Unsigned components const IR::U32 src0{GetSrc(inst.src[0])}; const IR::U32 src1{GetSrc(inst.src[1])}; const IR::U32 carry{GetCarryIn(inst)}; - const IR::Value tmp1{ir.IAddCarry(src0, src1)}; - const IR::U32 result1{ir.CompositeExtract(tmp1, 0)}; - const IR::U32 carry_out1{ir.CompositeExtract(tmp1, 1)}; - const IR::Value tmp2{ir.IAddCarry(result1, carry)}; - const IR::U32 result2{ir.CompositeExtract(tmp2, 0)}; - const IR::U32 carry_out2{ir.CompositeExtract(tmp2, 1)}; + const IR::U32 result1{ir.IAdd(src0, src1)}; + const IR::U32 result2{ir.IAdd(result1, carry)}; + const IR::U1 carry_out1{ir.ILessThan(result1, src0, false)}; + const IR::U1 carry_out2{ir.ILessThan(result2, result1, false)}; SetDst(inst.dst[0], result2); - const IR::U1 did_overflow{ir.INotEqual(ir.BitwiseOr(carry_out1, carry_out2), ir.Imm32(0))}; + const IR::U1 did_overflow{ir.LogicalOr(carry_out1, carry_out2)}; SetCarryOut(inst, did_overflow); } diff --git a/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp b/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp index e80d4fefc..67d361a8b 100644 --- a/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp +++ b/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp @@ -683,12 +683,10 @@ static bool IsReadConstSource(const IR::Value base) { void SimplifyReadConstAddressAdd(IR::Inst& inst) { // This handles the following pattern by combining the addition with the offset - // %82 = IAdd32 %65, #28816 - // %83 = ULessThan32 %82, %65 - // %84 = SelectU32 %83, #1, #0 - // %85 = IAdd32 %66, %84 - // %86 = CompositeConstructU32x2 %82, %85 - // %87 = ReadConst (flags=0x0) %86, #0 + // s_add_u32 s12, s2, + // s_addc_u32 s13, s3, 0 + // s_load_dword s16, s[12:13], 0x0 + if (inst.GetOpcode() != IR::Opcode::ReadConst) { return; }