pan/mdg: Apply abs/neg modifiers
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 29 Apr 2020 22:10:43 +0000 (18:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 May 2020 20:21:27 +0000 (20:21 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5102>

src/panfrost/midgard/midgard_compile.c

index 0f57ba67626e4583f92bb13910a016f04e6a4ea2..96a8c1c93970dad7c691571d1bde53307d722f71 100644 (file)
@@ -603,6 +603,15 @@ static void
 mir_copy_src(midgard_instruction *ins, nir_alu_instr *instr, unsigned i, unsigned to, bool *abs, bool *neg, bool is_int, unsigned bcast_count)
 {
         nir_alu_src src = instr->src[i];
+
+        if (!is_int) {
+                if (pan_has_source_mod(&src, nir_op_fneg))
+                        *neg = !(*neg);
+
+                if (pan_has_source_mod(&src, nir_op_fabs))
+                        *abs = true;
+        }
+
         unsigned bits = nir_src_bit_size(src.src);
 
         ins->src[to] = nir_src_index(NULL, &src.src);