nir/builder: add nir_ior_imm() helper
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/13719>
This commit is contained in:

committed by
Marge Bot

parent
bb40e999d1
commit
b8f087b0e6
@@ -731,6 +731,20 @@ nir_iand_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
||||
}
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ior_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
||||
{
|
||||
assert(x->bit_size <= 64);
|
||||
y &= BITFIELD64_MASK(x->bit_size);
|
||||
|
||||
if (y == 0) {
|
||||
return x;
|
||||
} else if (y == BITFIELD64_MASK(x->bit_size)) {
|
||||
return nir_imm_intN_t(build, y, x->bit_size);
|
||||
} else
|
||||
return nir_ior(build, x, nir_imm_intN_t(build, y, x->bit_size));
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ishl_imm(nir_builder *build, nir_ssa_def *x, uint32_t y)
|
||||
{
|
||||
|
Reference in New Issue
Block a user