From 8c9febe8f7ad5136615821e05a670bada794199b Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Thu, 29 Jul 2021 21:22:22 -0300
Subject: [PATCH] shader: Fold UnpackFloat2x16 and PackFloat2x16

Simplifies the code a bit when possible. These instructions should be
no-ops codegen wise.
---
 src/shader_recompiler/ir_opt/constant_propagation_pass.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index 8dd6d6c2c8..1e9ad0a0fd 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -476,6 +476,10 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
         return FoldInverseFunc(inst, IR::Opcode::UnpackHalf2x16);
     case IR::Opcode::UnpackHalf2x16:
         return FoldInverseFunc(inst, IR::Opcode::PackHalf2x16);
+    case IR::Opcode::PackFloat2x16:
+        return FoldInverseFunc(inst, IR::Opcode::UnpackFloat2x16);
+    case IR::Opcode::UnpackFloat2x16:
+        return FoldInverseFunc(inst, IR::Opcode::PackFloat2x16);
     case IR::Opcode::SelectU1:
     case IR::Opcode::SelectU8:
     case IR::Opcode::SelectU16: