From 3460d05a718f3859a77fe100f3972095d194be26 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Sep 2016 15:21:04 -0700 Subject: nir: Add 64-bit integer support for conversions and bitcasts v2 (idr): "cut them down later" => Remove ir_unop_b2u64 and ir_unop_u642b. Handle these with extra i2u or u2i casts just like uint(bool) and bool(uint) conversion is done. v3 (idr): Make the "from" type in a cast unsized. This reduces the number of required cast operations at the expensive slightly more complex code. However, this will be a dramatic improvement when other sized integer types are added. Suggested by Connor. Signed-off-by: Ian Romanick Reviewed-by: Connor Abbott --- src/compiler/glsl/glsl_to_nir.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/compiler/glsl/glsl_to_nir.cpp') diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index f4c3d01e723..7a1c1f4c8a2 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1480,6 +1480,7 @@ nir_visitor::visit(ir_expression *ir) case ir_unop_f2b: result = nir_f2b(&b, srcs[0]); break; case ir_unop_i2b: result = nir_i2b(&b, srcs[0]); break; case ir_unop_b2i: result = nir_b2i(&b, srcs[0]); break; + case ir_unop_b2i64:result = nir_b2i64(&b, srcs[0]); break; case ir_unop_d2f: result = nir_d2f(&b, srcs[0]); break; case ir_unop_f2d: result = nir_f2d(&b, srcs[0]); break; case ir_unop_d2i: result = nir_d2i(&b, srcs[0]); break; @@ -1493,12 +1494,40 @@ nir_visitor::visit(ir_expression *ir) assert(supports_ints); result = nir_u2d(&b, srcs[0]); break; + case ir_unop_i642i: result = nir_i2i32(&b, srcs[0]); break; + case ir_unop_i642u: result = nir_i2u32(&b, srcs[0]); break; + case ir_unop_i642f: result = nir_i642f(&b, srcs[0]); break; + case ir_unop_i642d: result = nir_i642d(&b, srcs[0]); break; + + case ir_unop_u642i: result = nir_u2i32(&b, srcs[0]); break; + case ir_unop_u642u: result = nir_u2u32(&b, srcs[0]); break; + case ir_unop_u642f: result = nir_u642f(&b, srcs[0]); break; + case ir_unop_u642d: result = nir_u642d(&b, srcs[0]); break; + + case ir_unop_i2i64: result = nir_i2i64(&b, srcs[0]); break; + case ir_unop_u2i64: result = nir_u2i64(&b, srcs[0]); break; + case ir_unop_f2i64: + case ir_unop_d2i64: + result = nir_f2i64(&b, srcs[0]); + break; + case ir_unop_i2u64: result = nir_i2u64(&b, srcs[0]); break; + case ir_unop_u2u64: result = nir_u2u64(&b, srcs[0]); break; + case ir_unop_f2u64: + case ir_unop_d2u64: + result = nir_f2u64(&b, srcs[0]); + break; case ir_unop_i2u: case ir_unop_u2i: + case ir_unop_i642u64: + case ir_unop_u642i64: case ir_unop_bitcast_i2f: case ir_unop_bitcast_f2i: case ir_unop_bitcast_u2f: case ir_unop_bitcast_f2u: + case ir_unop_bitcast_i642d: + case ir_unop_bitcast_d2i64: + case ir_unop_bitcast_u642d: + case ir_unop_bitcast_d2u64: case ir_unop_subroutine_to_int: /* no-op */ result = nir_imov(&b, srcs[0]); @@ -1552,6 +1581,14 @@ nir_visitor::visit(ir_expression *ir) case ir_unop_unpack_double_2x32: result = nir_unpack_double_2x32(&b, srcs[0]); break; + case ir_unop_pack_int_2x32: + case ir_unop_pack_uint_2x32: + result = nir_pack_int_2x32(&b, srcs[0]); + break; + case ir_unop_unpack_int_2x32: + case ir_unop_unpack_uint_2x32: + result = nir_unpack_int_2x32(&b, srcs[0]); + break; case ir_unop_bitfield_reverse: result = nir_bitfield_reverse(&b, srcs[0]); break; -- cgit v1.2.3