mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 11:30:11 +01:00
nir/builder: add ishl_imm helper
v2: add (y >= x->bit_size) condition (Caio) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13739>
This commit is contained in:
parent
3ab7f4471c
commit
e227bb9fd5
1 changed files with 12 additions and 0 deletions
|
|
@ -731,6 +731,18 @@ nir_iand_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
|||
}
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ishl_imm(nir_builder *build, nir_ssa_def *x, uint32_t y)
|
||||
{
|
||||
if (y == 0) {
|
||||
return x;
|
||||
} else if (y >= x->bit_size) {
|
||||
return nir_imm_intN_t(build, 0, x->bit_size);
|
||||
} else {
|
||||
return nir_ishl(build, x, nir_imm_int(build, y));
|
||||
}
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ishr_imm(nir_builder *build, nir_ssa_def *x, uint32_t y)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue