Commit 0e73d879 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜 Committed by Marge Bot
Browse files

pan/bi: Handle vectorized load_const



In preparation for 16-bit vectors.
Signed-off-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <!5307>
parent 1b09c699
Pipeline #155561 passed with stages
in 12 minutes and 21 seconds
...@@ -466,20 +466,29 @@ static void ...@@ -466,20 +466,29 @@ static void
emit_load_const(bi_context *ctx, nir_load_const_instr *instr) emit_load_const(bi_context *ctx, nir_load_const_instr *instr)
{ {
/* Make sure we've been lowered */ /* Make sure we've been lowered */
assert(instr->def.num_components == 1); assert(instr->def.num_components <= (32 / instr->def.bit_size));
/* Accumulate all the channels of the constant, as if we did an
* implicit SEL over them */
uint32_t acc = 0;
for (unsigned i = 0; i < instr->def.num_components; ++i) {
unsigned v = nir_const_value_as_uint(instr->value[i], instr->def.bit_size);
acc |= (v << (i * instr->def.bit_size));
}
bi_instruction move = { bi_instruction move = {
.type = BI_MOV, .type = BI_MOV,
.dest = pan_ssa_index(&instr->def), .dest = pan_ssa_index(&instr->def),
.dest_type = instr->def.bit_size | nir_type_uint, .dest_type = nir_type_uint32,
.src = { .src = {
BIR_INDEX_CONSTANT BIR_INDEX_CONSTANT
}, },
.src_types = { .src_types = {
instr->def.bit_size | nir_type_uint, nir_type_uint32,
}, },
.constant = { .constant = {
.u64 = nir_const_value_as_uint(instr->value[0], instr->def.bit_size) .u32 = acc
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment