Mesa (master): nir: add pack_32_2x16_split/unpack_32_2x16_split lowering
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 19:04:38 UTC 2020
Module: Mesa
Branch: master
Commit: 42093bb694bdcb6fb5bb762c118520c107456f4a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=42093bb694bdcb6fb5bb762c118520c107456f4a
Author: Jonathan Marek <jonathan at marek.ca>
Date: Fri Apr 24 14:27:33 2020 -0400
nir: add pack_32_2x16_split/unpack_32_2x16_split lowering
The new option replaces the two other _split lowering options, since
there's no need for separate options.
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Rob Clark <robdclark at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4738>
---
src/compiler/nir/nir.h | 4 ++--
src/compiler/nir/nir_opt_algebraic.py | 18 +++++++++++++++---
src/freedreno/ir3/ir3_nir.c | 6 ++----
src/panfrost/bifrost/bifrost_compile.h | 3 +--
src/panfrost/midgard/midgard_compile.h | 3 +--
5 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index ce12410b79b..59a034f1907 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -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;
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index bcf13bdf399..b2643641a8e 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -1295,15 +1295,27 @@ optimizations.extend([
(('pack_half_2x16_split', 'a at 32', 'b at 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 at 32'),
('f2f32', ('u2u16', a)),
- 'options->lower_unpack_half_2x16_split'),
+ 'options->lower_pack_split'),
(('unpack_half_2x16_split_y', 'a at 32'),
('f2f32', ('u2u16', ('ushr', a, 16))),
- 'options->lower_unpack_half_2x16_split'),
+ 'options->lower_pack_split'),
+
+ (('pack_32_2x16_split', 'a at 16', 'b at 16'),
+ ('ior', ('ishl', ('u2u32', b), 16), ('u2u32', a)),
+ 'options->lower_pack_split'),
+
+ (('unpack_32_2x16_split_x', 'a at 32'),
+ ('u2u16', a),
+ 'options->lower_pack_split'),
+
+ (('unpack_32_2x16_split_y', 'a at 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'),
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 146d9f0e9bd..8a67ea637d9 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -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,
diff --git a/src/panfrost/bifrost/bifrost_compile.h b/src/panfrost/bifrost/bifrost_compile.h
index 73e6847891c..a25ad314699 100644
--- a/src/panfrost/bifrost/bifrost_compile.h
+++ b/src/panfrost/bifrost/bifrost_compile.h
@@ -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,
diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h
index a995d12771a..7f87ae74c14 100644
--- a/src/panfrost/midgard/midgard_compile.h
+++ b/src/panfrost/midgard/midgard_compile.h
@@ -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,
More information about the mesa-commit
mailing list