nir: add pack_32_2x16_split/unpack_32_2x16_split lowering
authorJonathan Marek <jonathan@marek.ca>
Fri, 24 Apr 2020 18:27:33 +0000 (14:27 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Apr 2020 18:40:03 +0000 (18:40 +0000)
The new option replaces the two other _split lowering options, since
there's no need for separate options.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4738>

src/compiler/nir/nir.h
src/compiler/nir/nir_opt_algebraic.py
src/freedreno/ir3/ir3_nir.c
src/panfrost/bifrost/bifrost_compile.h
src/panfrost/midgard/midgard_compile.h

index ce12410b79bd04da474c099332b7196d5bf23bb6..59a034f1907a11645a2c934da9c4db292754080b 100644 (file)
@@ -2863,18 +2863,18 @@ typedef struct nir_shader_compiler_options {
    bool lower_ldexp;
 
    bool lower_pack_half_2x16;
-   bool lower_pack_half_2x16_split;
    bool lower_pack_unorm_2x16;
    bool lower_pack_snorm_2x16;
    bool lower_pack_unorm_4x8;
    bool lower_pack_snorm_4x8;
    bool lower_unpack_half_2x16;
-   bool lower_unpack_half_2x16_split;
    bool lower_unpack_unorm_2x16;
    bool lower_unpack_snorm_2x16;
    bool lower_unpack_unorm_4x8;
    bool lower_unpack_snorm_4x8;
 
+   bool lower_pack_split;
+
    bool lower_extract_byte;
    bool lower_extract_word;
 
index bcf13bdf399d5987c731fc397d7e1a27ccc36440..b2643641a8eb8f0566c120b22ac16f23333f5f7f 100644 (file)
@@ -1295,15 +1295,27 @@ optimizations.extend([
 
    (('pack_half_2x16_split', 'a@32', 'b@32'),
     ('ior', ('ishl', ('u2u32', ('f2f16', b)), 16), ('u2u32', ('f2f16', a))),
-    'options->lower_pack_half_2x16_split'),
+    'options->lower_pack_split'),
 
    (('unpack_half_2x16_split_x', 'a@32'),
     ('f2f32', ('u2u16', a)),
-    'options->lower_unpack_half_2x16_split'),
+    'options->lower_pack_split'),
 
    (('unpack_half_2x16_split_y', 'a@32'),
     ('f2f32', ('u2u16', ('ushr', a, 16))),
-    'options->lower_unpack_half_2x16_split'),
+    'options->lower_pack_split'),
+
+   (('pack_32_2x16_split', 'a@16', 'b@16'),
+    ('ior', ('ishl', ('u2u32', b), 16), ('u2u32', a)),
+    'options->lower_pack_split'),
+
+   (('unpack_32_2x16_split_x', 'a@32'),
+    ('u2u16', a),
+    'options->lower_pack_split'),
+
+   (('unpack_32_2x16_split_y', 'a@32'),
+    ('u2u16', ('ushr', 'a', 16)),
+    'options->lower_pack_split'),
 
    (('isign', a), ('imin', ('imax', a, -1), 1), 'options->lower_isign'),
    (('fsign', a), ('fsub', ('b2f', ('flt', 0.0, a)), ('b2f', ('flt', a, 0.0))), 'options->lower_fsign'),
index 146d9f0e9bda890d3980494162a9b3b72f4ec6a4..8a67ea637d977900257d6c7ed2b07a63481479f0 100644 (file)
@@ -58,17 +58,16 @@ static const nir_shader_compiler_options options = {
                .lower_bitfield_insert_to_shifts = true,
                .lower_bitfield_extract_to_shifts = true,
                .lower_pack_half_2x16 = true,
-               .lower_pack_half_2x16_split = true,
                .lower_pack_snorm_4x8 = true,
                .lower_pack_snorm_2x16 = true,
                .lower_pack_unorm_4x8 = true,
                .lower_pack_unorm_2x16 = true,
                .lower_unpack_half_2x16 = true,
-               .lower_unpack_half_2x16_split = true,
                .lower_unpack_snorm_4x8 = true,
                .lower_unpack_snorm_2x16 = true,
                .lower_unpack_unorm_4x8 = true,
                .lower_unpack_unorm_2x16 = true,
+               .lower_pack_split = true,
                .use_interpolated_input_intrinsics = true,
                .lower_rotate = true,
                .lower_to_scalar = true,
@@ -100,17 +99,16 @@ static const nir_shader_compiler_options options_a6xx = {
                .lower_bitfield_insert_to_shifts = true,
                .lower_bitfield_extract_to_shifts = true,
                .lower_pack_half_2x16 = true,
-               .lower_pack_half_2x16_split = true,
                .lower_pack_snorm_4x8 = true,
                .lower_pack_snorm_2x16 = true,
                .lower_pack_unorm_4x8 = true,
                .lower_pack_unorm_2x16 = true,
                .lower_unpack_half_2x16 = true,
-               .lower_unpack_half_2x16_split = true,
                .lower_unpack_snorm_4x8 = true,
                .lower_unpack_snorm_2x16 = true,
                .lower_unpack_unorm_4x8 = true,
                .lower_unpack_unorm_2x16 = true,
+               .lower_pack_split = true,
                .use_interpolated_input_intrinsics = true,
                .lower_rotate = true,
                .vectorize_io = true,
index 73e6847891c9a8aa84dd5605948bd52312bc0b22..a25ad314699b6aedcc54b98af08442aa10079144 100644 (file)
@@ -52,17 +52,16 @@ static const nir_shader_compiler_options bifrost_nir_options = {
         .lower_rotate = true,
 
         .lower_pack_half_2x16 = true,
-        .lower_pack_half_2x16_split = true,
         .lower_pack_unorm_2x16 = true,
         .lower_pack_snorm_2x16 = true,
         .lower_pack_unorm_4x8 = true,
         .lower_pack_snorm_4x8 = true,
         .lower_unpack_half_2x16 = true,
-        .lower_unpack_half_2x16_split = true,
         .lower_unpack_unorm_2x16 = true,
         .lower_unpack_snorm_2x16 = true,
         .lower_unpack_unorm_4x8 = true,
         .lower_unpack_snorm_4x8 = true,
+        .lower_pack_split = true,
 
         .lower_doubles_options = nir_lower_dmod,
 
index a995d12771a7fa3734f0efd47fa33b659918425e..7f87ae74c1416f7c3c55680748cd041376b616bd 100644 (file)
@@ -62,17 +62,16 @@ static const nir_shader_compiler_options midgard_nir_options = {
         .lower_rotate = true,
 
         .lower_pack_half_2x16 = true,
-        .lower_pack_half_2x16_split = true,
         .lower_pack_unorm_2x16 = true,
         .lower_pack_snorm_2x16 = true,
         .lower_pack_unorm_4x8 = true,
         .lower_pack_snorm_4x8 = true,
         .lower_unpack_half_2x16 = true,
-        .lower_unpack_half_2x16_split = true,
         .lower_unpack_unorm_2x16 = true,
         .lower_unpack_snorm_2x16 = true,
         .lower_unpack_unorm_4x8 = true,
         .lower_unpack_snorm_4x8 = true,
+        .lower_pack_split = true,
 
         .lower_doubles_options = nir_lower_dmod,