Mesa (master): nir/lower_locals_to_regs: cast array index to 32 bit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 19 04:57:58 UTC 2019


Module: Mesa
Branch: master
Commit: 0ccdf23a57ed8f2a8763f4187b440720fa912937
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ccdf23a57ed8f2a8763f4187b440720fa912937

Author: Karol Herbst <kherbst at redhat.com>
Date:   Fri Mar 15 16:06:22 2019 +0100

nir/lower_locals_to_regs: cast array index to 32 bit

local memory is too small to require 64 bit pointers, so cast the array index
to a 32 bit value to save up on 64 bit operations.

Signed-off-by: Karol Herbst <kherbst at redhat.com>

---

 src/compiler/nir/nir_lower_locals_to_regs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c
index 88599f49789..0316c8aead8 100644
--- a/src/compiler/nir/nir_lower_locals_to_regs.c
+++ b/src/compiler/nir/nir_lower_locals_to_regs.c
@@ -165,10 +165,10 @@ get_deref_reg_src(nir_deref_instr *deref, struct locals_to_regs_state *state)
          }
 
          assert(src.reg.indirect->is_ssa);
+         nir_ssa_def *index = nir_i2i(b, nir_ssa_for_src(b, d->arr.index, 1), 32);
          src.reg.indirect->ssa =
             nir_iadd(b, src.reg.indirect->ssa,
-                        nir_imul(b, nir_ssa_for_src(b, d->arr.index, 1),
-                                    nir_imm_int(b, inner_array_size)));
+                        nir_imul(b, index, nir_imm_int(b, inner_array_size)));
       }
 
       inner_array_size *= glsl_get_length(nir_deref_instr_parent(d)->type);




More information about the mesa-commit mailing list