[Mesa-dev] [PATCH 24/29] nir: add support for (un)pack_double_2x32
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Mon Mar 21 12:06:03 UTC 2016
From: Connor Abbott <connor.w.abbott at intel.com>
---
src/compiler/nir/glsl_to_nir.cpp | 6 ++++++
src/compiler/nir/nir_opcodes.py | 28 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
index d087a77..84a1747 100644
--- a/src/compiler/nir/glsl_to_nir.cpp
+++ b/src/compiler/nir/glsl_to_nir.cpp
@@ -1416,6 +1416,12 @@ nir_visitor::visit(ir_expression *ir)
case ir_unop_unpack_half_2x16:
result = nir_unpack_half_2x16(&b, srcs[0]);
break;
+ case ir_unop_pack_double_2x32:
+ result = nir_pack_double_2x32(&b, srcs[0]);
+ break;
+ case ir_unop_unpack_double_2x32:
+ result = nir_unpack_double_2x32(&b, srcs[0]);
+ break;
case ir_unop_bitfield_reverse:
result = nir_bitfield_reverse(&b, srcs[0]);
break;
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index cf6ce83..12b668f 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -260,6 +260,34 @@ dst.x = (src0.x << 0) |
(src0.w << 24);
""")
+unop_horiz("pack_double_2x32", 1, tfloat64, 2, tuint32, """
+union {
+ double d;
+ struct {
+ uint32_t i1;
+ uint32_t i2;
+ };
+} di;
+
+di.i1 = src0.x;
+di.i2 = src0.y;
+dst.x = di.d;
+""")
+
+unop_horiz("unpack_double_2x32", 2, tuint32, 1, tfloat64, """
+union {
+ double d;
+ struct {
+ uint32_t i1;
+ uint32_t i2;
+ };
+} di;
+
+di.d = src0.x;
+dst.x = di.i1;
+dst.y = di.i2;
+""")
+
# Lowered floating point unpacking operations.
--
2.5.0
More information about the mesa-dev
mailing list