summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorGravatar FernandoS272021-03-24 23:41:55 +0100
committerGravatar ameerj2021-07-22 21:51:24 -0400
commitc7c518e280d1ac04adb08d45145690fd06ac7b18 (patch)
tree1bce4c12238600828bef6bdf0c92da6f69c054b1 /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentshader: Implement SHFL (diff)
downloadyuzu-c7c518e280d1ac04adb08d45145690fd06ac7b18.tar.gz
yuzu-c7c518e280d1ac04adb08d45145690fd06ac7b18.tar.xz
yuzu-c7c518e280d1ac04adb08d45145690fd06ac7b18.zip
shader: Implement TLD4 and TLD4_B
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/constant_propagation_pass.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index 3dab424f6..28060dccf 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -403,6 +403,18 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
403 return (base >> shift) & ((1U << count) - 1); 403 return (base >> shift) & ((1U << count) - 1);
404 }); 404 });
405 return; 405 return;
406 case IR::Opcode::BitFieldSExtract:
407 FoldWhenAllImmediates(inst, [](s32 base, u32 shift, u32 count) {
408 const size_t back_shift = static_cast<size_t>(shift) + static_cast<size_t>(count);
409 if (back_shift > Common::BitSize<s32>()) {
410 throw LogicError("Undefined result in {}({}, {}, {})", IR::Opcode::BitFieldSExtract,
411 base, shift, count);
412 }
413 const size_t left_shift = Common::BitSize<s32>() - back_shift;
414 return static_cast<u32>(static_cast<s32>(base << left_shift) >>
415 static_cast<size_t>(Common::BitSize<s32>() - count));
416 });
417 return;
406 case IR::Opcode::BranchConditional: 418 case IR::Opcode::BranchConditional:
407 return FoldBranchConditional(inst); 419 return FoldBranchConditional(inst);
408 default: 420 default: