mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
r600/sfn: resolve constant indices into local arrays better
When the code is first generated constants are loaded to registers, so to avoid indirect array register access that can be resolved as a direct direct access we have to check whether the address register is loaded with a constant value. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36488>
This commit is contained in:
parent
874005aeb7
commit
356bc41797
1 changed files with 26 additions and 2 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include "sfn_alu_defines.h"
|
||||
#include "sfn_debug.h"
|
||||
#include "sfn_instr.h"
|
||||
#include "sfn_instr_alu.h"
|
||||
#include "sfn_valuefactory.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_math.h"
|
||||
|
|
@ -908,7 +909,17 @@ LocalArray::element(size_t offset, PVirtualValue indirect, uint32_t chan)
|
|||
if (indirect) {
|
||||
class ResolveDirectArrayElement : public ConstRegisterVisitor {
|
||||
public:
|
||||
void visit(const Register& value) { (void)value; };
|
||||
void visit(const Register& value)
|
||||
{
|
||||
if (value.has_flag(Register::ssa)) {
|
||||
assert(value.parents().size() == 1);
|
||||
auto p = (*value.parents().begin())->as_alu();
|
||||
if (p && p->can_propagate_src()) {
|
||||
auto& s = p->src(0);
|
||||
s.accept(*this);
|
||||
}
|
||||
}
|
||||
}
|
||||
void visit(const LocalArray& value)
|
||||
{
|
||||
(void)value;
|
||||
|
|
@ -921,7 +932,20 @@ LocalArray::element(size_t offset, PVirtualValue indirect, uint32_t chan)
|
|||
offset = value.value();
|
||||
is_contant = true;
|
||||
}
|
||||
void visit(const InlineConstant& value) { (void)value; }
|
||||
void visit(const InlineConstant& value)
|
||||
{
|
||||
switch (value.sel()) {
|
||||
case ALU_SRC_0:
|
||||
offset = 0;
|
||||
is_contant = true;
|
||||
break;
|
||||
case ALU_SRC_1_INT:
|
||||
offset = 1;
|
||||
is_contant = true;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
ResolveDirectArrayElement():
|
||||
offset(0),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue