From ba4a73a502a2da8cb8f68cb50ad2cb984569e36a Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 13 Mar 2020 16:09:06 +0000 Subject: [PATCH] nir/tests: fix callback for load/store vectorizer tests Signed-off-by: Rhys Perry Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/tests/load_store_vectorizer_tests.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/tests/load_store_vectorizer_tests.cpp b/src/compiler/nir/tests/load_store_vectorizer_tests.cpp index 739f2a269aa..81a955b8cb5 100644 --- a/src/compiler/nir/tests/load_store_vectorizer_tests.cpp +++ b/src/compiler/nir/tests/load_store_vectorizer_tests.cpp @@ -355,7 +355,14 @@ bool nir_load_store_vectorize_test::mem_vectorize_callback( unsigned num_components, nir_intrinsic_instr *low, nir_intrinsic_instr *high) { - return bit_size / 8; + /* Calculate a simple alignment, like how nir_intrinsic_align() does. */ + uint32_t align = align_mul; + if (align_offset) + align = 1 << (ffs(align_offset) - 1); + + /* Require scalar alignment and less than 5 components. */ + return align % (bit_size / 8) == 0 && + num_components <= 4; } void nir_load_store_vectorize_test::shared_type_info(