Mesa (master): panfrost/midgard: Factorize f2f and u2u handling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 22 15:52:31 UTC 2020


Module: Mesa
Branch: master
Commit: f53a0799c7d08b4c0125b95a89f872897a8e8cdf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f53a0799c7d08b4c0125b95a89f872897a8e8cdf

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Mon Jan 20 16:03:52 2020 +0100

panfrost/midgard: Factorize f2f and u2u handling

Those size conversion operations work the same way apart from f2f
using an fmov op code and u2u using an imov. Let's handle them in the
same case block to avoid code duplication.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3478>

---

 src/panfrost/midgard/midgard_compile.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index bec94a037c9..49b8f123661 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -849,8 +849,13 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
         case nir_op_u2u8:
         case nir_op_u2u16:
         case nir_op_u2u32:
-        case nir_op_u2u64: {
-                op = midgard_alu_op_imov;
+        case nir_op_u2u64:
+        case nir_op_f2f16:
+        case nir_op_f2f32: {
+                if (instr->op == nir_op_f2f16 || instr->op == nir_op_f2f32)
+                        op = midgard_alu_op_fmov;
+                else
+                        op = midgard_alu_op_imov;
 
                 if (dst_bitsize == (src_bitsize * 2)) {
                         /* Converting up */
@@ -866,24 +871,6 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
                 break;
         }
 
-        case nir_op_f2f16: {
-                assert(src_bitsize == 32);
-
-                op = midgard_alu_op_fmov;
-                dest_override = midgard_dest_override_lower;
-                break;
-        }
-
-        case nir_op_f2f32: {
-                assert(src_bitsize == 16);
-
-                op = midgard_alu_op_fmov;
-                half_2 = true;
-                reg_mode++;
-                break;
-        }
-
-
         /* For greater-or-equal, we lower to less-or-equal and flip the
          * arguments */
 



More information about the mesa-commit mailing list