pan/bi: Implement fabs, fneg as fmov with mods
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 10 Mar 2020 11:52:24 +0000 (07:52 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 10 Mar 2020 19:25:59 +0000 (19:25 +0000)
Fusing will come later with the appropriate NIR support.

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 8dccb16bbe6fe4fd466e4cde06647ed5eaac29b5..759f650f245161af30c4d2a654a074abed5742fe 100644 (file)
@@ -267,6 +267,8 @@ bi_class_for_nir_alu(nir_op op)
                 return BI_MINMAX;
 
         case nir_op_fsat:
+        case nir_op_fneg:
+        case nir_op_fabs:
         case nir_op_mov:
                 return BI_MOV;
 
@@ -353,6 +355,12 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         case nir_op_fsat:
                 alu.outmod = BIFROST_SAT; /* MOV */
                 break;
+        case nir_op_fneg:
+                alu.src_neg[0] = true; /* MOV */
+                break;
+        case nir_op_fabs:
+                alu.src_abs[0] = true; /* MOV */
+                break;
         case nir_op_fmax:
         case nir_op_imax:
         case nir_op_umax: