diff --git a/.pick_status.json b/.pick_status.json index 882410d5903..273774ad211 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3574,7 +3574,7 @@ "description": "ac/llvm: correctly split vector 8/16-bit stores", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 714dfe39e4d..2d95f06c74a 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -1571,11 +1571,14 @@ static void visit_store_ssbo(struct ac_nir_context *ctx, nir_intrinsic_instr *in num_bytes = 16; } - /* check alignment of 16 Bit stores */ - if (elem_size_bytes == 2 && num_bytes > 2 && (start % 2) == 1) { - writemask |= ((1u << (count - 1)) - 1u) << (start + 1); + /* check alignment of 8/16 Bit stores */ + uint32_t align_mul = nir_intrinsic_align_mul(instr); + uint32_t align_offset = nir_intrinsic_align_offset(instr) + start * elem_size_bytes; + uint32_t align = nir_combined_align(align_mul, align_offset & (align_mul - 1)); + if (align < MIN2(num_bytes, 4) || (ctx->ac.gfx_level == GFX6 && elem_size_bytes < 4)) { + writemask |= BITFIELD_RANGE(start + 1, count - 1); count = 1; - num_bytes = 2; + num_bytes = elem_size_bytes; } /* Due to alignment issues, split stores of 8-bit/16-bit