i965/fs: Implement new ir_unop_u2i and ir_unop_i2u opcodes.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 14 Jun 2011 20:04:32 +0000 (13:04 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Jun 2011 23:07:12 +0000 (16:07 -0700)
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>
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index 7f3f52854d23fbf2e21cc9639effc9c2838c9093..46677a6f2ef7b2de8f0c4b904f7221449824c233 100644 (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:
index 2704f06ceb3c3c3552026909ee6f5de099ce70f7..9091014976befe741690d77f742d33d8829f5681 100644 (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: