From 640afb33b95d6f92642f5e7580c0619c8f4cda85 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 20 Dec 2022 14:42:38 -0500 Subject: [PATCH] agx: Remove unused idiv const func This was used for instancing, but has been unused since 8dcf7648f15 ("agx: Lower VBOs in NIR") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 43 -------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 6415da85a95..6d812962c19 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -26,7 +26,6 @@ #include "agx_compile.h" #include "compiler/nir/nir_builder.h" #include "compiler/nir_types.h" -#include "util/fast_idiv_by_const.h" #include "util/glheader.h" #include "util/u_debug.h" #include "agx_builder.h" @@ -317,48 +316,6 @@ agx_umul_high(agx_builder *b, agx_index P, agx_index Q) return dst; } -/* Emit code dividing P by Q */ -static agx_index -agx_udiv_const(agx_builder *b, agx_index P, uint32_t Q) -{ - /* P / 1 = P */ - if (Q == 1) { - return P; - } - - /* P / UINT32_MAX = 0, unless P = UINT32_MAX when it's one */ - if (Q == UINT32_MAX) { - agx_index max = agx_mov_imm(b, 32, UINT32_MAX); - agx_index one = agx_mov_imm(b, 32, 1); - return agx_icmpsel(b, P, max, one, agx_zero(), AGX_ICOND_UEQ); - } - - /* P / 2^N = P >> N */ - if (util_is_power_of_two_or_zero(Q)) { - return agx_ushr(b, P, agx_mov_imm(b, 32, util_logbase2(Q))); - } - - /* Fall back on multiplication by a magic number */ - struct util_fast_udiv_info info = util_compute_fast_udiv_info(Q, 32, 32); - agx_index preshift = agx_mov_imm(b, 32, info.pre_shift); - agx_index increment = agx_mov_imm(b, 32, info.increment); - agx_index postshift = agx_mov_imm(b, 32, info.post_shift); - agx_index multiplier = agx_mov_imm(b, 32, info.multiplier); - agx_index n = P; - - if (info.pre_shift != 0) - n = agx_ushr(b, n, preshift); - if (info.increment != 0) - n = agx_iadd(b, n, increment, 0); - - n = agx_umul_high(b, n, multiplier); - - if (info.post_shift != 0) - n = agx_ushr(b, n, postshift); - - return n; -} - static enum agx_format agx_format_for_pipe(enum pipe_format format) {