compiler/nir: add nir_fadd_imm() and nir_fmul_imm() helpers
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 14 Dec 2018 08:28:56 +0000 (09:28 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Wed, 2 Jan 2019 06:54:05 +0000 (07:54 +0100)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_builder.h

index 74ecde798d55b5d37cbb92c4914d49bc6791c229..14f3baab20b06eae4b54191ad140ae730407a699 100644 (file)
@@ -571,6 +571,18 @@ nir_imul_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
    return nir_imul(build, x, nir_imm_intN_t(build, y, x->bit_size));
 }
 
+static inline nir_ssa_def *
+nir_fadd_imm(nir_builder *build, nir_ssa_def *x, double y)
+{
+   return nir_fadd(build, x, nir_imm_floatN_t(build, y, x->bit_size));
+}
+
+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));
+}
+
 static inline nir_ssa_def *
 nir_pack_bits(nir_builder *b, nir_ssa_def *src, unsigned dest_bit_size)
 {