[Mesa-dev] [PATCH 26/29] nir: add split versions of (un)pack_double_2x32

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Mar 21 12:06:05 UTC 2016


From: Connor Abbott <connor.w.abbott at intel.com>

---
 src/compiler/nir/nir_opcodes.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 12b668f..11da111 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -296,6 +296,29 @@ unop_horiz("unpack_half_2x16_split_x", 1, tfloat32, 1, tuint32,
 unop_horiz("unpack_half_2x16_split_y", 1, tfloat32, 1, tuint32,
            "unpack_half_1x16((uint16_t)(src0.x >> 16))")
 
+unop_convert("unpack_double_2x32_split_x", tuint32, tfloat64, """
+union {
+    double d;
+    struct {
+        uint32_t x;
+        uint32_t y;
+    };
+} di;
+di.d = src0;
+dst = di.x;
+""")
+
+unop_convert("unpack_double_2x32_split_y", tuint32, tfloat64, """
+union {
+    double d;
+    struct {
+        uint32_t x;
+        uint32_t y;
+    };
+} di;
+di.d = src0;
+dst = di.y;
+""")
 
 # Bit operations, part of ARB_gpu_shader5.
 
@@ -561,6 +584,19 @@ binop("fpow", tfloat, "", "bit_size == 64 ? powf(src0, src1) : pow(src0, src1)")
 binop_horiz("pack_half_2x16_split", 1, tuint32, 1, tfloat32, 1, tfloat32,
             "pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16)")
 
+binop_convert("pack_double_2x32_split", tfloat64, tuint32, "", """
+union {
+    double d;
+    struct {
+        uint32_t x;
+        uint32_t y;
+    };
+} di;
+di.x = src0;
+di.y = src1;
+dst = di.d;
+""")
+
 # bfm implements the behavior of the first operation of the SM5 "bfi" assembly
 # and that of the "bfi1" i965 instruction. That is, it has undefined behavior
 # if either of its arguments are 32.
-- 
2.5.0



More information about the mesa-dev mailing list