From 4be0e46e61cdbba78ab03c13aa1d735876499c41 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 24 Mar 2026 10:00:52 -0400 Subject: [PATCH] pan/bi: Allow 64-bit vectors in bi_make_vec_to() Reviewed-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Christoph Pillmayer Reviewed-by: Lorenzo Rossi Part-of: --- src/panfrost/compiler/bifrost/bifrost_compile.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/panfrost/compiler/bifrost/bifrost_compile.c b/src/panfrost/compiler/bifrost/bifrost_compile.c index d5171234a5b..73d7b6a952c 100644 --- a/src/panfrost/compiler/bifrost/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost/bifrost_compile.c @@ -881,15 +881,24 @@ bi_instr * bi_make_vec_to(bi_builder *b, bi_index dst, bi_index *src, unsigned *channel, unsigned count, unsigned bitsize) { - assert(bitsize == 8 || bitsize == 16 || bitsize == 32); - unsigned shift = (bitsize == 32) ? 0 : (bitsize == 16) ? 1 : 2; - unsigned chan_per_word = 1 << shift; - assert(DIV_ROUND_UP(count * bitsize, 32) <= BI_MAX_SRCS && "unnecessarily large vector should have been lowered"); bi_index srcs[BI_MAX_VEC]; + if (bitsize == 64) { + for (unsigned i = 0; i < count; i++) { + const unsigned c = channel ? channel[i] : 0; + srcs[i * 2 + 0] = bi_extract(b, src[i], c * 2 + 0); + srcs[i * 2 + 1] = bi_extract(b, src[i], c * 2 + 1); + } + return bi_emit_collect_to(b, dst, srcs, count * 2); + } + + assert(bitsize == 8 || bitsize == 16 || bitsize == 32); + unsigned shift = (bitsize == 32) ? 0 : (bitsize == 16) ? 1 : 2; + unsigned chan_per_word = 1 << shift; + for (unsigned i = 0; i < count; i += chan_per_word) { unsigned rem = MIN2(count - i, chan_per_word); unsigned *channel_offset = channel ? (channel + i) : NULL;