From 0ef104b057504a67bccca518b44c03021a10e528 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 8 May 2023 09:07:53 +0200 Subject: [PATCH] nir: add nir_fsub_imm This is similar to nir_isub_imm, but for floats. Reviewed-by: Faith Ekstrand Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_builder.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 943bde0..c6a476f 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -795,6 +795,12 @@ nir_fadd_imm(nir_builder *build, nir_ssa_def *x, double y) } static inline nir_ssa_def * +nir_fsub_imm(nir_builder *build, double x, nir_ssa_def *y) +{ + return nir_fsub(build, nir_imm_floatN_t(build, x, y->bit_size), y); +} + +static inline nir_ssa_def * nir_fmul_imm(nir_builder *build, nir_ssa_def *x, double y) { return nir_fmul(build, x, nir_imm_floatN_t(build, y, x->bit_size)); -- 2.7.4