From: Connor Abbott Date: Fri, 2 Aug 2019 12:56:20 +0000 (+0200) Subject: nir/builder: Add nir_b2i X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7fd90e8ef6dc9cf12108f53409fb71f0133cb01;p=mesa.git nir/builder: Add nir_b2i Same as nir_b2f but for integers. Reviewed-by: Marek Olšák --- diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 2fed76106eb..0f300aef155 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -1166,6 +1166,18 @@ nir_b2f(nir_builder *build, nir_ssa_def *b, uint32_t bit_size) }; } +static inline nir_ssa_def * +nir_b2i(nir_builder *build, nir_ssa_def *b, uint32_t bit_size) +{ + switch (bit_size) { + case 64: return nir_b2i64(build, b); + case 32: return nir_b2i32(build, b); + case 16: return nir_b2i16(build, b); + case 8: return nir_b2i8(build, b); + default: + unreachable("Invalid bit-size"); + }; +} static inline nir_ssa_def * nir_load_barycentric(nir_builder *build, nir_intrinsic_op op, unsigned interp_mode)