aco/isel: Simplify nested branching code
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 0a79856..3ea30a7 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -2978,12 +2978,15 @@
unsigned bytes_needed = load_size - bytes_read;
/* add buffer for unaligned loads */
- int byte_align = align_mul % 4 == 0 ? align_offset % 4 : -1;
+ int byte_align = 0;
+ if (params.byte_align_loads) {
+ byte_align = align_mul % 4 == 0 ? align_offset % 4 : -1;
+ }
if (byte_align) {
- if (params.byte_align_loads && (bytes_needed > 2 ||
- (bytes_needed == 2 && (align_mul % 2 || align_offset % 2)) ||
- !params.supports_8bit_16bit_loads)) {
+ if (bytes_needed > 2 ||
+ (bytes_needed == 2 && (align_mul % 2 || align_offset % 2)) ||
+ !params.supports_8bit_16bit_loads) {
if (info->component_stride) {
assert(params.supports_8bit_16bit_loads && "unimplemented");
bytes_needed = 2;