[Mesa-dev] [PATCH 1/2] i965: Emit MOVs for neg/abs.

Ian Romanick idr at freedesktop.org
Thu Aug 15 19:38:33 PDT 2013


On 08/12/2013 01:18 PM, Matt Turner wrote:
> Necessary to avoid combining a bitcast and a modifier into a single
> operation. Otherwise if safe, the MOV should be removed by
> copy-propagation or register coalescing.

Has that been verified with shaderdb?

> ---
>   src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 4 ++--
>   src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index ee7728c..fa4554b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -361,12 +361,12 @@ fs_visitor::visit(ir_expression *ir)
>         break;
>      case ir_unop_neg:
>         op[0].negate = !op[0].negate;
> -      this->result = op[0];
> +      emit(MOV(this->result, op[0]));
>         break;
>      case ir_unop_abs:
>         op[0].abs = true;
>         op[0].negate = false;
> -      this->result = op[0];
> +      emit(MOV(this->result, op[0]));
>         break;
>      case ir_unop_sign:
>         temp = fs_reg(this, ir->type);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 8d4a5d4..05c0091 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -1391,12 +1391,12 @@ vec4_visitor::visit(ir_expression *ir)
>         break;
>      case ir_unop_neg:
>         op[0].negate = !op[0].negate;
> -      this->result = op[0];
> +      emit(MOV(result_dst, op[0]));
>         break;
>      case ir_unop_abs:
>         op[0].abs = true;
>         op[0].negate = false;
> -      this->result = op[0];
> +      emit(MOV(result_dst, op[0]));
>         break;
>
>      case ir_unop_sign:
>



More information about the mesa-dev mailing list