pan/mdg: Obey f2fmp size restriction in fuse_io_16
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 10 Sep 2020 20:47:37 +0000 (16:47 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Sep 2020 23:35:13 +0000 (23:35 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>

src/panfrost/midgard/nir_fuse_io_16.c

index ed4b775..a588f6a 100644 (file)
@@ -87,6 +87,15 @@ nir_fuse_io_16(nir_shader *shader)
                continue;
 
             intr->dest.ssa.bit_size = 16;
+
+            nir_builder b;
+            nir_builder_init(&b, function->impl);
+            b.cursor = nir_after_instr(instr);
+
+            /* The f2f32(f2fmp(x)) will cancel by opt_algebraic */
+            nir_ssa_def *conv = nir_f2f32(&b, &intr->dest.ssa);
+            nir_ssa_def_rewrite_uses_after(&intr->dest.ssa, nir_src_for_ssa(conv), conv->parent_instr);
+
             progress |= true;
          }
       }