summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-29 04:38:35 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:40 +0200
commitb9069c7891f2516ea037e9355daea284a1d540f1 (patch)
treea85e8c84357bdc55eab021197af27dd0bd03570f /src/shader_recompiler/frontend
parentshader: Only apply shift on register mode for IADD3 (diff)
downloadyuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar.gz
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar.bz2
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar.lz
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar.xz
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.tar.zst
yuzu-b9069c7891f2516ea037e9355daea284a1d540f1.zip
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
index b50017536..040cfc10f 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
@@ -36,8 +36,12 @@ enum class Half : u64 {
switch (shift) {
case Shift::None:
return value;
- case Shift::Right:
- return ir.ShiftRightLogical(value, ir.Imm32(16));
+ case Shift::Right: {
+ // 33-bit RS IADD3 edge case
+ const IR::U1 edge_case{ir.GetCarryFromOp(value)};
+ const IR::U32 shifted{ir.ShiftRightLogical(value, ir.Imm32(16))};
+ return IR::U32{ir.Select(edge_case, ir.IAdd(shifted, ir.Imm32(0x10000)), shifted)};
+ }
case Shift::Left:
return ir.ShiftLeftLogical(value, ir.Imm32(16));
}
@@ -67,6 +71,10 @@ void IADD3(TranslatorVisitor& v, u64 insn, IR::U32 op_a, IR::U32 op_b, IR::U32 o
}
IR::U32 lhs_1{v.ir.IAdd(op_a, op_b)};
if (iadd3.x != 0) {
+ // TODO: How does RS behave when X is set?
+ if (shift == Shift::Right) {
+ throw NotImplementedException("IADD3 X+RS");
+ }
const IR::U32 carry{v.ir.Select(v.ir.GetCFlag(), v.ir.Imm32(1), v.ir.Imm32(0))};
lhs_1 = v.ir.IAdd(lhs_1, carry);
}