mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 01:20:17 +01:00
nir: generate nir_{cmp}_imm variants
We have a couple of open-coded variants of these, but let's generate all of them for completeness. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23393>
This commit is contained in:
parent
28b1c5bca1
commit
82465f1418
2 changed files with 16 additions and 12 deletions
|
|
@ -750,18 +750,6 @@ nir_iadd_nuw(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
|
|||
return d;
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ieq_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
||||
{
|
||||
return nir_ieq(build, x, nir_imm_intN_t(build, y, x->bit_size));
|
||||
}
|
||||
|
||||
static inline nir_ssa_def *
|
||||
nir_ine_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
|
||||
{
|
||||
return nir_ine(build, x, nir_imm_intN_t(build, y, x->bit_size));
|
||||
}
|
||||
|
||||
/* Use nir_iadd(x, -y) for reversing parameter ordering */
|
||||
static inline nir_ssa_def *
|
||||
nir_isub_imm(nir_builder *build, uint64_t y, nir_ssa_def *x)
|
||||
|
|
|
|||
|
|
@ -167,6 +167,22 @@ _nir_build_${name}(build${intrinsic_macro_list(opcode)}, (struct _nir_${name}_in
|
|||
#define nir_${name} nir_build_${name}
|
||||
% endfor
|
||||
|
||||
% for name in ['flt', 'fge', 'feq', 'fneu']:
|
||||
static inline nir_ssa_def *
|
||||
nir_${name}_imm(nir_builder *build, nir_ssa_def *src1, double src2)
|
||||
{
|
||||
return nir_${name}(build, src1, nir_imm_floatN_t(build, src2, src1->bit_size));
|
||||
}
|
||||
% endfor
|
||||
|
||||
% for name in ['ilt', 'ige', 'ieq', 'ine', 'ult', 'uge']:
|
||||
static inline nir_ssa_def *
|
||||
nir_${name}_imm(nir_builder *build, nir_ssa_def *src1, uint64_t src2)
|
||||
{
|
||||
return nir_${name}(build, src1, nir_imm_intN_t(build, src2, src1->bit_size));
|
||||
}
|
||||
% endfor
|
||||
|
||||
#endif /* _NIR_BUILDER_OPCODES_ */"""
|
||||
|
||||
from nir_opcodes import opcodes, type_size, type_base_type
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue