mesa/src/asahi/lib/agx_nir_format_helpers.h
Alyssa Rosenzweig 09d31922de nir: Drop "SSA" from NIR language
Everything is SSA now.

   sed -e 's/nir_ssa_def/nir_def/g' \
       -e 's/nir_ssa_undef/nir_undef/g' \
       -e 's/nir_ssa_scalar/nir_scalar/g' \
       -e 's/nir_src_rewrite_ssa/nir_src_rewrite/g' \
       -e 's/nir_gather_ssa_types/nir_gather_types/g' \
       -i $(git grep -l nir | grep -v relnotes)

   git mv src/compiler/nir/nir_gather_ssa_types.c \
          src/compiler/nir/nir_gather_types.c

   ninja -C build/ clang-format
   cd src/compiler/nir && find *.c *.h -type f -exec clang-format -i \{} \;

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24585>
2023-08-12 16:44:41 -04:00

32 lines
799 B
C

/*
* Copyright 2022 Alyssa Rosenzweig
* SPDX-License-Identifier: MIT
*/
#ifndef __AGX_NIR_FORMAT_HELPERS_H
#define __AGX_NIR_FORMAT_HELPERS_H
#include "util/format/u_formats.h"
#include "nir_builder.h"
#include "nir_format_convert.h"
static inline nir_def *
nir_sign_extend_if_sint(nir_builder *b, nir_def *x, enum pipe_format format)
{
if (!util_format_is_pure_sint(format))
return x;
const struct util_format_description *desc = util_format_description(format);
unsigned bits[4] = {0};
for (unsigned i = 0; i < desc->nr_channels; ++i) {
assert(desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED ||
desc->channel[i].type == UTIL_FORMAT_TYPE_VOID);
bits[i] = desc->channel[i].size;
}
return nir_format_sign_extend_ivec(b, x, bits);
}
#endif