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:
Lionel Landwerlin
2021-10-22 16:10:20 +03:00
committed by Marge Bot
parent bb40e999d1
commit b8f087b0e6

View File

@@ -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)
{