Mesa (main): aco/isel: avoid unnecessary calls to nir_unsigned_upper_bound()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 16:30:34 UTC 2021


Module: Mesa
Branch: main
Commit: 114d38e57d78b4141a8cf4359437773f931877a5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=114d38e57d78b4141a8cf4359437773f931877a5

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Jul 14 13:47:01 2021 +0200

aco/isel: avoid unnecessary calls to nir_unsigned_upper_bound()

These were responsible for ~20% of the time
spent in instruction selection.
Reduces overall compile times by ~0.5%.

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11879>

---

 src/amd/compiler/aco_instruction_selection.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 85f5ae23dde..d5a48264ff8 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -855,8 +855,8 @@ emit_vop2_instruction(isel_context* ctx, nir_alu_instr* instr, aco_opcode op, Te
    Operand op1(src1);
 
    for (int i = 0; i < 2; i++) {
-      uint32_t src_ub = get_alu_src_ub(ctx, instr, swap_srcs ? !i : i);
       if (uses_ub & (1 << i)) {
+         uint32_t src_ub = get_alu_src_ub(ctx, instr, swap_srcs ? !i : i);
          if (src_ub <= 0xffff)
             bld.set16bit(i ? op1 : op0);
          else if (src_ub <= 0xffffff)



More information about the mesa-commit mailing list