[Mesa-dev] [PATCH 3/6] i965/fs: Implement nir_opcode_fsub/isub support.

Connor Abbott cwabbott0 at gmail.com
Tue Mar 24 15:48:15 PDT 2015


We already have a lower_negate compiler option, so I think it would be
better to add the 1 line of code to lower sub -> neg predicated on
!lower_neg to nir_opt_algebraic.

On Mon, Mar 23, 2015 at 8:37 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> prog_to_nir uses this for OPCODE_SUB.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 69f296c..094303f 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -905,6 +905,12 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)
>        inst->saturate = instr->dest.saturate;
>        break;
>
> +   case nir_op_fsub:
> +   case nir_op_isub:
> +      inst = emit(ADD(result, op[0], negate(op[1])));
> +      inst->saturate = instr->dest.saturate;
> +      break;
> +
>     case nir_op_fmul:
>        inst = emit(MUL(result, op[0], op[1]));
>        inst->saturate = instr->dest.saturate;
> --
> 2.3.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list