agx: Factor out allows_16bit_immediate check
The optimizer needs this information to inline immediates effectively. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21430>
This commit is contained in:

committed by
Marge Bot

parent
445ca949cd
commit
c9728b41d5
@@ -808,6 +808,7 @@ agx_validate(UNUSED agx_context *ctx, UNUSED const char *after_str)
|
||||
|
||||
unsigned agx_read_registers(agx_instr *I, unsigned s);
|
||||
unsigned agx_write_registers(agx_instr *I, unsigned d);
|
||||
bool agx_allows_16bit_immediate(agx_instr *I);
|
||||
|
||||
struct agx_copy {
|
||||
/* Base register destination of the copy */
|
||||
|
14
src/asahi/compiler/agx_ir.c
Normal file
14
src/asahi/compiler/agx_ir.c
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2022 Alyssa Rosenzweig
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "agx_compiler.h"
|
||||
|
||||
bool
|
||||
agx_allows_16bit_immediate(agx_instr *I)
|
||||
{
|
||||
return (I->op == AGX_OPCODE_DEVICE_LOAD) ||
|
||||
(I->op == AGX_OPCODE_DEVICE_STORE) ||
|
||||
(I->op == AGX_OPCODE_UNIFORM_STORE) || (I->op == AGX_OPCODE_ATOMIC);
|
||||
}
|
@@ -103,9 +103,7 @@ agx_validate_sources(agx_instr *I)
|
||||
agx_validate_assert(!src.cache);
|
||||
agx_validate_assert(!src.discard);
|
||||
|
||||
bool ldst = (I->op == AGX_OPCODE_DEVICE_LOAD) ||
|
||||
(I->op == AGX_OPCODE_UNIFORM_STORE) ||
|
||||
(I->op == AGX_OPCODE_ATOMIC);
|
||||
bool ldst = agx_allows_16bit_immediate(I);
|
||||
|
||||
/* Immediates are encoded as 8-bit (16-bit for memory load/store). For
|
||||
* integers, they extend to 16-bit. For floating point, they are 8-bit
|
||||
|
@@ -37,6 +37,7 @@ libasahi_agx_files = files(
|
||||
'agx_lower_uniform_sources.c',
|
||||
'agx_pack.c',
|
||||
'agx_print.c',
|
||||
'agx_ir.c',
|
||||
'agx_opt_cse.c',
|
||||
'agx_optimizer.c',
|
||||
'agx_register_allocate.c',
|
||||
|
Reference in New Issue
Block a user