Mesa (main): freedreno/ir3: Fold 16-bit conversions into image load/store src/dsts.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 23:05:10 UTC 2022
Module: Mesa
Branch: main
Commit: 49dc60efa1df60563a7e992f5070ed10541ab8af
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49dc60efa1df60563a7e992f5070ed10541ab8af
Author: Emma Anholt <emma at anholt.net>
Date: Thu May 19 13:41:34 2022 -0700
freedreno/ir3: Fold 16-bit conversions into image load/store src/dsts.
Shaves 5 instructions off of one manhattan31 shader.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16616>
---
src/freedreno/ir3/ir3_image.c | 2 +-
src/freedreno/ir3/ir3_nir.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/freedreno/ir3/ir3_image.c b/src/freedreno/ir3/ir3_image.c
index 23a34398088..f52c188944a 100644
--- a/src/freedreno/ir3/ir3_image.c
+++ b/src/freedreno/ir3/ir3_image.c
@@ -116,7 +116,7 @@ type_t
ir3_get_type_for_image_intrinsic(const nir_intrinsic_instr *instr)
{
const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
- int bit_size = info->has_dest ? nir_dest_bit_size(instr->dest) : 32;
+ int bit_size = info->has_dest ? nir_dest_bit_size(instr->dest) : nir_src_bit_size(instr->src[3]);
nir_alu_type type = nir_type_uint;
switch (instr->intrinsic) {
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 1b6bbe5ce0a..1fbc113a8ad 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -755,6 +755,8 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
(1 << nir_tex_src_ddy),
~0);
+ OPT(s, nir_fold_16bit_image_load_store_conversions);
+
/* Now that we stripped off the 16-bit conversions, legalize so that we
* don't have a mix of 16- and 32-bit args that will need to be
* collected together in the coordinate vector.
More information about the mesa-commit
mailing list