pan/bi: Implement nir_op_vec8 and nir_op_vec16

These are used with OpenCL, particularly with 8-bit types. Luckily, they are
pretty easy to implement with our existing infrastructure. We just need to hit
backspace enough times and we're good to go.

Fixes a subtest of test_basic hiloeo.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17220>
This commit is contained in:
Alyssa Rosenzweig
2022-06-22 15:42:43 -04:00
committed by Marge Bot
parent 7d07fb9a67
commit a68bed798c

View File

@@ -2329,29 +2329,21 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
switch (instr->op) {
case nir_op_vec2:
case nir_op_vec3:
case nir_op_vec4: {
bi_index unoffset_srcs[4] = {
srcs > 0 ? bi_src_index(&instr->src[0].src) : bi_null(),
srcs > 1 ? bi_src_index(&instr->src[1].src) : bi_null(),
srcs > 2 ? bi_src_index(&instr->src[2].src) : bi_null(),
srcs > 3 ? bi_src_index(&instr->src[3].src) : bi_null(),
};
case nir_op_vec4:
case nir_op_vec8:
case nir_op_vec16: {
bi_index unoffset_srcs[16] = { bi_null() };
unsigned channels[16] = { 0 };
unsigned channels[4] = {
instr->src[0].swizzle[0],
instr->src[1].swizzle[0],
srcs > 2 ? instr->src[2].swizzle[0] : 0,
srcs > 3 ? instr->src[3].swizzle[0] : 0,
};
for (unsigned i = 0; i < srcs; ++i) {
unoffset_srcs[i] = bi_src_index(&instr->src[i].src);
channels[i] = instr->src[i].swizzle[0];
}
bi_make_vec_to(b, dst, unoffset_srcs, channels, srcs, sz);
return;
}
case nir_op_vec8:
case nir_op_vec16:
unreachable("should've been lowered");
case nir_op_unpack_32_2x16: {
/* Should have been scalarized */
assert(comps == 2 && sz == 16);