Skip to content
Snippets Groups Projects
Commit a9536794 authored by Timur Kristóf's avatar Timur Kristóf Committed by Dylan Baker
Browse files

aco: Fix constant address offset calculation for ds_read2 instructions.


Cc: mesa-stable
Signed-off-by: default avatarTimur Kristóf <timur.kristof@gmail.com>
Reviewed-by: default avatarRhys Perry <pendingchaos02@gmail.com>
Part-of: <mesa/mesa!9678>
(cherry picked from commit 89c8e22c)
parent 74af2631
No related branches found
No related tags found
Loading
......@@ -58,7 +58,7 @@
"description": "aco: Fix constant address offset calculation for ds_read2 instructions.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},
......
......@@ -3506,14 +3506,16 @@ Temp lds_load_callback(Builder& bld, const LoadEmitInfo &info,
op = aco_opcode::ds_read_u8;
}
 
unsigned max_offset_plus_one = read2 ? 254 * (size / 2u) + 1 : 65536;
if (const_offset >= max_offset_plus_one) {
offset = bld.vadd32(bld.def(v1), offset, Operand(const_offset / max_offset_plus_one));
const_offset %= max_offset_plus_one;
unsigned const_offset_unit = read2 ? size / 2u : 1u;
unsigned const_offset_range = read2 ? 255 * const_offset_unit : 65536;
if (const_offset > (const_offset_range - const_offset_unit)) {
unsigned excess = const_offset - (const_offset % const_offset_range);
offset = bld.vadd32(bld.def(v1), offset, Operand(excess));
const_offset -= excess;
}
 
if (read2)
const_offset /= (size / 2u);
const_offset /= const_offset_unit;
 
RegClass rc = RegClass(RegType::vgpr, DIV_ROUND_UP(size, 4));
Temp val = rc == info.dst.regClass() && dst_hint.id() ? dst_hint : bld.tmp(rc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment