From 7ec9dc98d7a35b57348fbc43e3fb3a9d39d01eb7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 16 Feb 2021 19:55:00 -0500 Subject: [PATCH] pan/bi: Add imm_f16 helper Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index aa2f4f71d2d..4030fa46081 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -32,6 +32,7 @@ #include "compiler/nir/nir.h" #include "panfrost/util/pan_ir.h" #include "util/u_math.h" +#include "util/half_float.h" /* Swizzles across bytes in a 32-bit word. Expresses swz in the XML directly. * To express widen, use the correpsonding replicated form, i.e. H01 = identity @@ -225,6 +226,12 @@ bi_imm_u16(uint16_t imm) return bi_half(bi_imm_u32(imm), false); } +static inline bi_index +bi_imm_f16(float imm) +{ + return bi_imm_u16(_mesa_float_to_half(imm)); +} + static inline bool bi_is_null(bi_index idx) {