diff options
author | Rob Clark <[email protected]> | 2020-06-03 12:12:54 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-03 21:24:13 +0000 |
commit | 0f3255ef0aefaf7a7aca4f7ee8a334cf91bf2c99 (patch) | |
tree | 5e1483a8027116d184b7383bae1ac428360b90b2 /src/compiler/nir | |
parent | 866618c5c86fbbb59036845c1d6e38d8e526b525 (diff) |
nir/builder: add bitsize conversion helpers
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_builder.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index de84bc85784..48b22888516 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -1399,4 +1399,28 @@ nir_convert_to_bit_size(nir_builder *b, return nir_build_alu(b, opcode, src, NULL, NULL, NULL); } +static inline nir_ssa_def * +nir_i2iN(nir_builder *b, nir_ssa_def *src, unsigned bit_size) +{ + return nir_convert_to_bit_size(b, src, nir_type_int, bit_size); +} + +static inline nir_ssa_def * +nir_u2uN(nir_builder *b, nir_ssa_def *src, unsigned bit_size) +{ + return nir_convert_to_bit_size(b, src, nir_type_uint, bit_size); +} + +static inline nir_ssa_def * +nir_b2bN(nir_builder *b, nir_ssa_def *src, unsigned bit_size) +{ + return nir_convert_to_bit_size(b, src, nir_type_bool, bit_size); +} + +static inline nir_ssa_def * +nir_f2fN(nir_builder *b, nir_ssa_def *src, unsigned bit_size) +{ + return nir_convert_to_bit_size(b, src, nir_type_float, bit_size); +} + #endif /* NIR_BUILDER_H */ |