nir: fix nir_const_value_as_uint bit size in load/store vectorizer tests
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 4 Feb 2020 11:42:17 +0000 (11:42 +0000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 13 Feb 2020 10:53:37 +0000 (10:53 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3690>

src/compiler/nir/nir_opt_load_store_vectorize.c
src/compiler/nir/tests/load_store_vectorizer_tests.cpp

index 6587251c7e794263388e3c67c262e49262d69010..414a97fec458abf4b148f68ae63a6d3487de1ec4 100644 (file)
@@ -38,6 +38,8 @@
  * - It won't turn four consecutive vec3 loads into 3 vec4 loads.
  * - It doesn't do global vectorization.
  * Handling these cases probably wouldn't provide much benefit though.
+ *
+ * This probably doesn't handle big-endian GPUs correctly.
 */
 
 #include "nir.h"
index cd623704fc38323c30943fada9daa4caace2a659..0d749debd4c4b673b853ceab791bc3d154a392f2 100644 (file)
@@ -961,10 +961,10 @@ TEST_F(nir_load_store_vectorize_test, ssbo_store_adjacent_8_8_16)
    ASSERT_EQ(val->bit_size, 8);
    ASSERT_EQ(val->num_components, 4);
    nir_const_value *cv = nir_instr_as_load_const(val->parent_instr)->value;
-   ASSERT_EQ(nir_const_value_as_uint(cv[0], 32), 0x10);
-   ASSERT_EQ(nir_const_value_as_uint(cv[1], 32), 0x20);
-   ASSERT_EQ(nir_const_value_as_uint(cv[2], 32), 0x30);
-   ASSERT_EQ(nir_const_value_as_uint(cv[3], 32), 0x0);
+   ASSERT_EQ(nir_const_value_as_uint(cv[0], 8), 0x10);
+   ASSERT_EQ(nir_const_value_as_uint(cv[1], 8), 0x20);
+   ASSERT_EQ(nir_const_value_as_uint(cv[2], 8), 0x30);
+   ASSERT_EQ(nir_const_value_as_uint(cv[3], 8), 0x0);
 }
 
 TEST_F(nir_load_store_vectorize_test, ssbo_store_adjacent_32_32_64)