From d4c6fbc4a7e4345fc78221f106901146ca75b721 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 9 Jul 2024 17:17:05 -0400 Subject: [PATCH] nir: add nir_alu_instr float controls queries These are helpful now that float_controls2 exists, these are common patterns worth factoring out into helpers. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Konstantin Seurer Part-of: --- src/compiler/nir/nir.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 4ac6f38dbd5..57dc5228761 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1625,6 +1625,30 @@ typedef struct nir_alu_instr { nir_alu_src src[]; } nir_alu_instr; +static inline bool +nir_alu_instr_is_signed_zero_preserve(nir_alu_instr *alu) +{ + return nir_is_float_control_signed_zero_preserve(alu->fp_fast_math, alu->def.bit_size); +} + +static inline bool +nir_alu_instr_is_inf_preserve(nir_alu_instr *alu) +{ + return nir_is_float_control_inf_preserve(alu->fp_fast_math, alu->def.bit_size); +} + +static inline bool +nir_alu_instr_is_nan_preserve(nir_alu_instr *alu) +{ + return nir_is_float_control_nan_preserve(alu->fp_fast_math, alu->def.bit_size); +} + +static inline bool +nir_alu_instr_is_signed_zero_inf_nan_preserve(nir_alu_instr *alu) +{ + return nir_is_float_control_signed_zero_inf_nan_preserve(alu->fp_fast_math, alu->def.bit_size); +} + void nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src); nir_component_mask_t