The python code stores the integer match values to the 64-bit unsigned field, so 32-bit values like 0xff000000 don't get sign extended. However, ~0 gets printed as -0x1, so it does get stored as ~0ull.
To be able to match both ways that the python code generates integers, cast the 64-bit int value back to int32_t and then re-sign-extend it. --- src/compiler/nir/nir_search.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 68275e442fca..8ad69e980a26 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -211,10 +211,18 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src, case nir_type_int: for (unsigned i = 0; i < num_components; ++i) { + int64_t const_int = const_val->data.i; int64_t val; switch (load->def.bit_size) { case 32: val = load->value.i32[new_swizzle[i]]; + /* The python code sometimes stores the ints it's searching for + * as 32-bit unsigned (like 0xff000000), and sometimes as + * 64-bit signed (like -0x1). Make sure that we get both + * sign-extended from 32 bits the same as we sign-extend our + * NIR constant load. + */ + const_int = (int32_t)const_val->data.i; break; case 64: val = load->value.i64[new_swizzle[i]]; @@ -223,7 +231,7 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src, unreachable("unknown bit size"); } - if (val != const_val->data.i) + if (val != const_int) return false; } return true; -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev