i965/fs: Implement new ir_unop_u2i and ir_unop_i2u opcodes.

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@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Kenneth Graunke 2011-06-14 13:04:32 -07:00
parent 006d5a1aa4
commit b633ddeb9f
2 changed files with 10 additions and 0 deletions

View file

@ -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:

View file

@ -349,6 +349,14 @@ fs_visitor::visit(ir_expression *ir)
emit_math(FS_OPCODE_RSQ, this->result, op[0]);
break;
case ir_unop_i2u:
op[0].type = BRW_REGISTER_TYPE_UD;
this->result = op[0];
break;
case ir_unop_u2i:
op[0].type = BRW_REGISTER_TYPE_D;
this->result = op[0];
break;
case ir_unop_i2f:
case ir_unop_b2f:
case ir_unop_b2i: