nir: Fix cast
We were wrongly telling `nir_const_value_as_uint()` that `iter` had
`bit_size` bits, but in one case it is explicitly i64. This works on
little endian platforms, but caused the nir_loop_unroll_test.fadd{,_rev}
tests to fail on big endian platforms.
Bug: https://bugs.gentoo.org/921297
Fixes: 268ad47c11 ("nir/loop_analyze: Handle bit sizes correctly in calculate_iterations")
Reviewed-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/26964>
This commit is contained in:
parent
3923d43908
commit
5997cf7587
1 changed files with 3 additions and 1 deletions
|
|
@ -827,6 +827,7 @@ get_iteration(nir_op cond_op, nir_const_value initial, nir_const_value step,
|
|||
unsigned execution_mode)
|
||||
{
|
||||
nir_const_value span, iter;
|
||||
unsigned iter_bit_size = bit_size;
|
||||
|
||||
switch (invert_comparison_if_needed(cond_op, invert_cond)) {
|
||||
case nir_op_ine:
|
||||
|
|
@ -880,13 +881,14 @@ get_iteration(nir_op cond_op, nir_const_value initial, nir_const_value step,
|
|||
iter = eval_const_binop(nir_op_fdiv, bit_size, span,
|
||||
step, execution_mode);
|
||||
iter = eval_const_unop(nir_op_f2i64, bit_size, iter, execution_mode);
|
||||
iter_bit_size = 64;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint64_t iter_u64 = nir_const_value_as_uint(iter, bit_size);
|
||||
uint64_t iter_u64 = nir_const_value_as_uint(iter, iter_bit_size);
|
||||
return iter_u64 > INT_MAX ? -1 : (int)iter_u64;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue