diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 15f5924cf31..6328c806507 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -3198,11 +3198,16 @@ bi_emit_valhall_offsets(bi_builder *b, nir_tex_instr *instr) /* No multisample index with 3D */ assert((nr <= 2) || (ms_idx < 0)); - dest = bi_mkvec_v4i8(b, + /* Zero extend the Z byte so we can use it with MKVEC.v2i8 */ + bi_index z = (nr > 2) ? + bi_mkvec_v2i8(b, bi_byte(bi_extract(b, idx, 2), 0), + bi_imm_u8(0), bi_zero()) : + bi_zero(); + + dest = bi_mkvec_v2i8(b, (nr > 0) ? bi_byte(bi_extract(b, idx, 0), 0) : bi_imm_u8(0), (nr > 1) ? bi_byte(bi_extract(b, idx, 1), 0) : bi_imm_u8(0), - (nr > 2) ? bi_byte(bi_extract(b, idx, 2), 0) : bi_imm_u8(0), - bi_imm_u8(0)); + z); } /* Component 2: multisample index */ diff --git a/src/panfrost/bifrost/valhall/ISA.xml b/src/panfrost/bifrost/valhall/ISA.xml index a5e35f9f572..495bac43edf 100644 --- a/src/panfrost/bifrost/valhall/ISA.xml +++ b/src/panfrost/bifrost/valhall/ISA.xml @@ -2110,15 +2110,15 @@ Cube face index - + Calculates $A | (B \ll 8) | (CD \ll 16)$ for 8-bit A and B and 16-bit CD. To implement `(uchar4) (A, B, C, D)` in full generality, use the sequence - `MKVEC.v4i8 CD, C, D, #0; MKVEC.v4i8 out, A, B, CD` + `MKVEC.v2i8 CD, C, D, #0; MKVEC.v2i8 out, A, B, CD` - `MKVEC.v4i8` also allows zero extending arbitrary 8-bit lanes. For - example, to extend `r0.b3` to `r1`, use `MKVEC.v4i8 r1, r0.b3, 0x0.b0, 0x0`. + `MKVEC.v2i8` also allows zero extending arbitrary 8-bit lanes. For + example, to extend `r0.b3` to `r1`, use `MKVEC.v2i8 r1, r0.b3, 0x0.b0, 0x0`. A B diff --git a/src/panfrost/bifrost/valhall/test/assembler-cases.txt b/src/panfrost/bifrost/valhall/test/assembler-cases.txt index 44d21a1225d..59a4d7c6167 100644 --- a/src/panfrost/bifrost/valhall/test/assembler-cases.txt +++ b/src/panfrost/bifrost/valhall/test/assembler-cases.txt @@ -152,10 +152,10 @@ c0 77 05 04 00 c2 a1 00 MKVEC.v2i16 r2, 0x0.h00, ^r55.h10 77 00 04 10 00 c2 90 00 S16_TO_S32 r2, ^r55.h10 c0 77 01 08 00 c2 a8 00 ISUB.s32 r2, 0x0, ^r55.h0 c0 77 01 0c 00 c2 a8 00 ISUB.s32 r2, 0x0, ^r55.h1 -00 c0 c0 00 c0 c7 bd 00 MKVEC.v4i8 r7, r0.b3, 0x0.b0, 0x0 -00 c0 c0 00 80 c6 bd 00 MKVEC.v4i8 r6, r0.b2, 0x0.b0, 0x0 -00 c0 c0 00 00 c4 bd 00 MKVEC.v4i8 r4, r0.b0, 0x0.b0, 0x0 -40 c0 c0 00 40 c5 bd 00 MKVEC.v4i8 r5, ^r0.b1, 0x0.b0, 0x0 +00 c0 c0 00 c0 c7 bd 00 MKVEC.v2i8 r7, r0.b3, 0x0.b0, 0x0 +00 c0 c0 00 80 c6 bd 00 MKVEC.v2i8 r6, r0.b2, 0x0.b0, 0x0 +00 c0 c0 00 00 c4 bd 00 MKVEC.v2i8 r4, r0.b0, 0x0.b0, 0x0 +40 c0 c0 00 40 c5 bd 00 MKVEC.v2i8 r5, ^r0.b1, 0x0.b0, 0x0 00 00 11 30 00 c7 90 00 U8_TO_F32 r7, r0.b3 00 00 11 20 00 c6 90 00 U8_TO_F32 r6, r0.b2 00 00 11 00 00 c4 90 00 U8_TO_F32 r4, r0.b0