nir: Add alignment information to cast derefs

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
This commit is contained in:
Jason Ekstrand
2020-08-24 09:51:04 -05:00
committed by Marge Bot
parent a0b82c24b6
commit 878a8daca6
5 changed files with 19 additions and 1 deletions
+6
View File
@@ -418,6 +418,12 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state)
/* We just validate that the type and mode are there */
validate_assert(state, instr->mode);
validate_assert(state, instr->type);
if (instr->cast.align_mul > 0) {
validate_assert(state, util_is_power_of_two_nonzero(instr->cast.align_mul));
validate_assert(state, instr->cast.align_offset < instr->cast.align_mul);
} else {
validate_assert(state, instr->cast.align_offset == 0);
}
} else {
/* We require the parent to be SSA. This may be lifted in the future */
validate_assert(state, instr->parent.is_ssa);