mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
agx: Handle constant-offset in address matching
Match iadd(x, #y). The format shift will get constant-folded away and, if y is sufficiently small, the constant will be inlined by the AGX backend optimizer. This gets rid of piles of 64-bit arithmetic from lowering UBOs. It probably doesn't matter for perf since that's happening in preamble shaders but it *is* noisy. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21108>
This commit is contained in:
parent
c3f7abaaef
commit
221311e1e9
1 changed files with 11 additions and 0 deletions
|
|
@ -37,6 +37,17 @@ match_address(nir_ssa_scalar base, int8_t format_shift)
|
|||
};
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(summands); ++i) {
|
||||
/* We can add a small constant to the 64-bit base for free */
|
||||
if (nir_ssa_scalar_is_const(summands[i])) {
|
||||
return (struct match){
|
||||
.base = summands[1 - i],
|
||||
.offset = summands[i],
|
||||
.shift = -format_shift,
|
||||
.sign_extend = true,
|
||||
};
|
||||
}
|
||||
|
||||
/* Otherwise, we can only add an offset extended from 32-bits */
|
||||
if (!nir_ssa_scalar_is_alu(summands[i]))
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue