From f4b1c12bab17bc497dadc3226bf9d63cb0b5b041 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 16 Dec 2020 10:28:17 -0500 Subject: [PATCH] pan/bi: Add imm_f32 helper Pattern comes up surprisingly often. 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 341ad2d8ae5..dcdd9de3b95 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -31,6 +31,7 @@ #include "bi_opcodes.h" #include "compiler/nir/nir.h" #include "panfrost/util/pan_ir.h" +#include "util/u_math.h" /* Bifrost opcodes are tricky -- the same op may exist on both FMA and * ADD with two completely different opcodes, and opcodes can be varying @@ -449,6 +450,12 @@ bi_imm_u32(uint32_t imm) }; } +static inline bi_index +bi_imm_f32(float imm) +{ + return bi_imm_u32(fui(imm)); +} + static inline bi_index bi_null() {