Mesa (master): nir/tests: fix callback for load/store vectorizer tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 6 20:54:15 UTC 2021


Module: Mesa
Branch: master
Commit: ba4a73a502a2da8cb8f68cb50ad2cb984569e36a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba4a73a502a2da8cb8f68cb50ad2cb984569e36a

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Mar 13 16:09:06 2020 +0000

nir/tests: fix callback for load/store vectorizer tests

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774>

---

 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(



More information about the mesa-commit mailing list