pan/bi: Implement fsat as mov.sat
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 10 Mar 2020 01:02:51 +0000 (21:02 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 10 Mar 2020 19:25:59 +0000 (19:25 +0000)
Soon we'll have a NIR support to handle this the Right Way along with
pos and sat_signed support, but we'll always need the fallback anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

src/panfrost/bifrost/bifrost_compile.c

index 8068825b826b8e9328b305d4f97eae092b1353a8..bbc3398602c9ced476ae5aa3427515169ef134ca 100644 (file)
@@ -231,6 +231,7 @@ bi_class_for_nir_alu(nir_op op)
         switch (op) {
         case nir_op_fadd: return BI_ADD;
         case nir_op_fmul: return BI_FMA;
+        case nir_op_fsat:
         case nir_op_mov:  return BI_MOV;
         default: unreachable("Unknown ALU op");
         }
@@ -302,6 +303,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         case nir_op_fmul:
                 alu.src[2] = BIR_INDEX_ZERO; /* FMA */
                 break;
+        case nir_op_fsat:
+                alu.outmod = BIFROST_SAT; /* MOV */
+                break;
         default:
                 break;
         }