pan/va: Replace MKVEC.v4i8 with MKVEC.v2i8

This is the instruction that the hardware actually supports. Do the rename, use
the more specific accurate model in the IR, and rework the Valhall texturing
code to emit MKVEC.v2i8 instead of MKVEC.v4i8.

Will fix:

   dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.*

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17101>
This commit is contained in:
Alyssa Rosenzweig 2022-06-17 11:59:09 -04:00 committed by Marge Bot
parent c570693c19
commit fd021a618f
3 changed files with 16 additions and 11 deletions

View file

@ -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 */

View file

@ -2110,15 +2110,15 @@
<src>Cube face index</src>
</ins>
<ins name="MKVEC.v4i8" title="Make 8-bit vector" dests="1" opcode="0xBD" unit="CVT">
<ins name="MKVEC.v2i8" title="Make 8-bit vector" dests="1" opcode="0xBD" unit="CVT">
<desc>
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`.
</desc>
<src lane="true">A</src>
<src lane="true">B</src>

View file

@ -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