[Mesa-dev] [PATCH 4/9] i965: Implement new ir_unop_u2i and ir_unop_i2u opcodes.

Eric Anholt eric at anholt.net
Wed Jun 29 15:45:15 PDT 2011


On Wed, 15 Jun 2011 00:49:33 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> No MOV is necessary since signed/unsigned integers share the same
> bit-representation; it's simply a question of interpretation.  In
> particular, the fs_reg::imm union shouldn't need updating.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  .../dri/i965/brw_fs_channel_expressions.cpp        |    2 ++
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp       |    6 ++++++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
> index 7f3f528..46677a6 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
> @@ -191,6 +191,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
>     case ir_unop_log:
>     case ir_unop_exp2:
>     case ir_unop_log2:
> +   case ir_unop_i2u:
> +   case ir_unop_u2i:
>     case ir_unop_f2i:
>     case ir_unop_i2f:
>     case ir_unop_f2b:
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index b485787..3c415b2 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -349,6 +349,12 @@ fs_visitor::visit(ir_expression *ir)
>        emit_math(FS_OPCODE_RSQ, this->result, op[0]);
>        break;
>  
> +   case ir_unop_i2u:
> +      this->result.type = BRW_REGISTER_TYPE_UD;
> +      break;
> +   case ir_unop_u2i:
> +      this->result.type = BRW_REGISTER_TYPE_D;
> +      break;

Comparing these opcodes to ir_unop_neg, I think you mean:
      op[0].type = WHATEVER;
      this->result = op[0];

sounds like we don't have any execution tests for these new opcodes?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110629/20e96b29/attachment.pgp>


More information about the mesa-dev mailing list