summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-09-01 15:21:04 -0700
committerIan Romanick <[email protected]>2017-01-20 15:41:23 -0800
commit3460d05a718f3859a77fe100f3972095d194be26 (patch)
tree0367cda6b97e8afd4ef5a23a1bf88381e9e356fd /src/compiler/glsl/glsl_to_nir.cpp
parent3ca0029a0dc7b2ed2c61de72ef16e7ad1831c101 (diff)
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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_to_nir.cpp')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp37
1 files changed, 37 insertions, 0 deletions
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;