nir_lower_mem_access_bit_sizes: fix negative chunk offsets
With a 64 bit pointer model, instead of doing -1 the pass ended up doing +4294967295. The reason here was some implicit integer conversion going horribly wrong, so just do the offset math in 64 bit to get a nice result. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13023 Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34669> (cherry picked from commit 33965bb21bac40840cf07958f509dcada4ead979)
This commit is contained in:

committed by
Eric Engestrom

parent
5973aa8505
commit
148d66678e
@@ -774,7 +774,7 @@
|
||||
"description": "nir_lower_mem_access_bit_sizes: fix negative chunk offsets",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
@@ -239,7 +239,7 @@ lower_mem_load(nir_builder *b, nir_intrinsic_instr *intrin,
|
||||
/* In this case, we know how much to adjust the offset */
|
||||
uint32_t delta = chunk_align_offset % requested.align;
|
||||
nir_def *load_offset =
|
||||
nir_iadd_imm(b, offset, chunk_start - (int)delta);
|
||||
nir_iadd_imm(b, offset, (int64_t)chunk_start - (int64_t)delta);
|
||||
|
||||
const uint32_t load_align_offset =
|
||||
(chunk_align_offset - delta) % align_mul;
|
||||
|
Reference in New Issue
Block a user