summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@collabora.com>2022-01-15 14:00:17 -0500
committerMarge Bot <emma+marge@anholt.net>2022-02-19 03:02:10 +0000
commita8418abd748e8e761dda9c3594e29e560833d9ff (patch)
tree40bce292a002fc10b5cffb7b10353885f5a34c5a
parent21bdee7bccd2b9b4b4f3b8b2eefce0466fc4b621 (diff)
pan/bi: Revert "Fix load_const of 1-bit booleans"
This reverts commit 29d319c767394b685e2b421a89a7e8e7103e2688. Now that we use nir_lower_bool_to_bitsize, we don't see 1-bit booleans anymore, so the issue this fixed doesn't apply. Actually, that issue was (in part) why I started looking into boolean handling in the first place. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14576>
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c4
-rw-r--r--src/panfrost/bifrost/compiler.h23
2 files changed, 5 insertions, 22 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 3a4ccc80c3e..ea251343cfb 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -1455,9 +1455,7 @@ bi_emit_load_const(bi_builder *b, nir_load_const_instr *instr)
uint32_t acc = 0;
for (unsigned i = 0; i < instr->def.num_components; ++i) {
- uint32_t v = nir_const_value_as_uint(instr->value[i], instr->def.bit_size);
-
- v = bi_extend_constant(v, instr->def.bit_size);
+ unsigned v = nir_const_value_as_uint(instr->value[i], instr->def.bit_size);
acc |= (v << (i * instr->def.bit_size));
}
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 72d21da8ee4..fddc5217e9c 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -761,19 +761,6 @@ bi_temp_reg(bi_context *ctx)
return bi_get_index(ctx->reg_alloc++, true, 0);
}
-/* NIR booleans are 1-bit (0/1). For now, backend IR booleans are N-bit
- * (0/~0) where N depends on the context. This requires us to sign-extend
- * when converting constants from NIR to the backend IR.
- */
-static inline uint32_t
-bi_extend_constant(uint32_t constant, unsigned bit_size)
-{
- if (bit_size == 1 && constant != 0)
- return ~0;
- else
- return constant;
-}
-
/* Inline constants automatically, will be lowered out by bi_lower_fau where a
* constant is not allowed. load_const_to_scalar gaurantees that this makes
* sense */
@@ -781,13 +768,11 @@ bi_extend_constant(uint32_t constant, unsigned bit_size)
static inline bi_index
bi_src_index(nir_src *src)
{
- if (nir_src_is_const(*src) && nir_src_bit_size(*src) <= 32) {
- uint32_t v = nir_src_as_uint(*src);
-
- return bi_imm_u32(bi_extend_constant(v, nir_src_bit_size(*src)));
- } else if (src->is_ssa) {
+ if (nir_src_is_const(*src) && nir_src_bit_size(*src) <= 32)
+ return bi_imm_u32(nir_src_as_uint(*src));
+ else if (src->is_ssa)
return bi_get_index(src->ssa->index, false, 0);
- } else {
+ else {
assert(!src->reg.indirect);
return bi_get_index(src->reg.reg->index, true, 0);
}