nir: Add a nir_test_mask helper
nir_ine_imm(b, nir_iand_imm(b, x, mask), 0) and nir_i2b(b, nir_iand_imm(b, x, mask)) are common patterns which become quite messy when they are part of a larger expression. Clang-format does not improve things either and we can end up with some rather interesting looking code. (RADV ray tracing pipeline and query lowering) Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17242>
This commit is contained in:
parent
3ae0c39a58
commit
1018d0f9c0
|
@ -740,6 +740,13 @@ nir_iand_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
|||
}
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_test_mask(nir_builder *build, nir_ssa_def *x, uint64_t mask)
|
||||
{
|
||||
assert(mask <= BITFIELD64_MASK(x->bit_size));
|
||||
return nir_ine_imm(build, nir_iand_imm(build, x, mask), 0);
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ior_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue