aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-13 13:51:06 -0400
committerMarge Bot <[email protected]>2020-05-25 20:03:52 +0000
commitfcbc022787d4fdfcfdf843d9f720a587e1f0579d (patch)
tree7c79ab32faddcb68c8ec17b067c21f1382eaaedf /src/compiler
parent46d5b07c5c39d1b8cf10976f6574a63062dea9c4 (diff)
nir: Add un/pack_32_4x8 opcodes
Complement the existing un/pack_32_2x16 opcodes. These are useful for 8-bit format packing. On Midgard, they are equivalent to just a 32-bit move, but other GPUs could lower to other packs if needed. Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5107>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opcodes.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 03f00d12639..142d7a427d5 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -99,6 +99,7 @@ tbool8 = "bool8"
tbool16 = "bool16"
tbool32 = "bool32"
tuint = "uint"
+tuint8 = "uint8"
tuint16 = "uint16"
tfloat16 = "float16"
tfloat32 = "float32"
@@ -357,6 +358,9 @@ dst.x = (src0.x << 0) |
(src0.w << 24);
""")
+unop_horiz("pack_32_4x8", 1, tuint32, 4, tuint8,
+ "dst.x = src0.x | ((uint32_t)src0.y << 8) | ((uint32_t)src0.z << 16) | ((uint32_t)src0.w << 24);")
+
unop_horiz("pack_32_2x16", 1, tuint32, 2, tuint16,
"dst.x = src0.x | ((uint32_t)src0.y << 16);")
@@ -375,6 +379,9 @@ unop_horiz("unpack_64_4x16", 4, tuint16, 1, tuint64,
unop_horiz("unpack_32_2x16", 2, tuint16, 1, tuint32,
"dst.x = src0.x; dst.y = src0.x >> 16;")
+unop_horiz("unpack_32_4x8", 4, tuint8, 1, tuint32,
+ "dst.x = src0.x; dst.y = src0.x >> 8; dst.z = src0.x >> 16; dst.w = src0.x >> 24;")
+
unop_horiz("unpack_half_2x16_flush_to_zero", 2, tfloat32, 1, tuint32, """
dst.x = unpack_half_1x16_flush_to_zero((uint16_t)(src0.x & 0xffff));
dst.y = unpack_half_1x16_flush_to_zero((uint16_t)(src0.x << 16));