v3d: Emit a simpler negate for the iabs implementation.
authorEric Anholt <eric@anholt.net>
Tue, 19 Feb 2019 02:13:09 +0000 (18:13 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 19 Feb 2019 02:13:09 +0000 (18:13 -0800)
One program affected in my shader-db.

instructions in affected programs: 110 -> 108 (-1.82%)

src/broadcom/compiler/nir_to_vir.c

index dc65e379b7fb217fbb99dbb781a1cea5736d5be4..4a0fd7d20e7fda8ff05a6a97466fd180d6384030 100644 (file)
@@ -1027,8 +1027,7 @@ ntq_emit_alu(struct v3d_compile *c, nir_alu_instr *instr)
         }
 
         case nir_op_iabs:
-                result = vir_MAX(c, src[0],
-                                vir_SUB(c, vir_uniform_ui(c, 0), src[0]));
+                result = vir_MAX(c, src[0], vir_NEG(c, src[0]));
                 break;
 
         case nir_op_fddx: