aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/tests
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-03-07 11:45:13 -0600
committerJason Ekstrand <[email protected]>2019-03-07 21:20:30 +0000
commit1664de5924aa6d761be21afdee411654121515d1 (patch)
treeea9484e48251e569e7c06e3541c8c9664158020f /src/compiler/nir/tests
parentfcf2a0122e9ccf3be8d1fa3bd18b8dedbebd6acf (diff)
nir/builder: Add a build_deref_array_imm helper
Unlike most of the cases in which we do this by hand, the new helper properly handles non-32-bit pointers. Reviewed-by: Karol Herbst <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler/nir/tests')
-rw-r--r--src/compiler/nir/tests/vars_tests.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/nir/tests/vars_tests.cpp b/src/compiler/nir/tests/vars_tests.cpp
index 893ce297a43..f72b6b99f62 100644
--- a/src/compiler/nir/tests/vars_tests.cpp
+++ b/src/compiler/nir/tests/vars_tests.cpp
@@ -476,7 +476,7 @@ TEST_F(nir_copy_prop_vars_test, load_direct_array_deref_on_vector_reuses_previou
/* This load will be dropped, as vec.y (or vec[1]) is already known. */
nir_deref_instr *deref =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 1));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 1);
nir_ssa_def *loaded_from_deref = nir_load_deref(b, deref);
/* This store should use the value loaded from in1. */
@@ -509,7 +509,7 @@ TEST_F(nir_copy_prop_vars_test, load_direct_array_deref_on_vector_reuses_previou
/* This load will be replaced with one from in0. */
nir_deref_instr *deref =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 1));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 1);
nir_load_deref(b, deref);
nir_validate_shader(b->shader, NULL);
@@ -532,7 +532,7 @@ TEST_F(nir_copy_prop_vars_test, load_direct_array_deref_on_vector_gets_reused)
/* Loading "vec[1]" deref will save the information about vec.y. */
nir_deref_instr *deref =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 1));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 1);
nir_load_deref(b, deref);
/* Store to vec.x. */
@@ -566,16 +566,16 @@ TEST_F(nir_copy_prop_vars_test, store_load_direct_array_deref_on_vector)
/* Store to "vec[1]" and "vec[0]". */
nir_deref_instr *store_deref_y =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 1));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 1);
nir_store_deref(b, store_deref_y, nir_imm_int(b, 20), 1);
nir_deref_instr *store_deref_x =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 0));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 0);
nir_store_deref(b, store_deref_x, nir_imm_int(b, 10), 1);
/* Both loads below will be dropped, because the values are already known. */
nir_deref_instr *load_deref_y =
- nir_build_deref_array(b, nir_build_deref_var(b, vec), nir_imm_int(b, 1));
+ nir_build_deref_array_imm(b, nir_build_deref_var(b, vec), 1);
nir_store_var(b, out0, nir_load_deref(b, load_deref_y), 1);
nir_store_var(b, out1, nir_load_var(b, vec), 1);