brw/emit: Add correct 3-source instruction assertions for each platform

Specifically, allow two immediate sources for BFE on Gfx12+. I stumbled
on this while trying some stuff with !31852.

v2: Don't be lazy. Add proper assertions for all the things on all the
platforms. Based on a suggestion by Ken.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Fixes: 7bed11fbde ("intel/brw: Allow immediates in the BFE instruction on Gfx12+")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31858>
This commit is contained in:
Ian Romanick
2024-10-25 20:03:41 -07:00
committed by Marge Bot
parent aebc6c974f
commit c1c09e3c4a

View File

@@ -548,9 +548,27 @@ brw_alu3(struct brw_codegen *p, unsigned opcode, struct brw_reg dest,
assert(dest.nr < XE2_MAX_GRF);
if (devinfo->ver >= 10)
assert(!(src0.file == IMM &&
src2.file == IMM));
if (devinfo->ver <= 9) {
assert(src0.file != IMM && src2.file != IMM);
} else if (devinfo->ver <= 11) {
/* On Ice Lake, BFE and CSEL cannot have any immediate sources. */
assert((opcode != BRW_OPCODE_BFE && opcode != BRW_OPCODE_CSEL) ||
(src0.file != IMM && src2.file != IMM));
/* On Ice Lake, DP4A and MAD can only have one immediate source. */
assert((opcode != BRW_OPCODE_DP4A && opcode != BRW_OPCODE_MAD) ||
!(src0.file == IMM && src2.file == IMM));
} else {
/* Having two immediate sources is allowed, but this should have been
* converted to a regular ADD by brw_fs_opt_algebraic.
*/
assert(opcode == BRW_OPCODE_ADD3 ||
!(src0.file == IMM && src2.file == IMM));
}
/* BFI2 cannot have any immediate sources on any platform. */
assert(opcode != BRW_OPCODE_BFI2 ||
(src0.file != IMM && src2.file != IMM));
assert(src0.file == IMM || src0.nr < XE2_MAX_GRF);
assert(src1.file != IMM && src1.nr < XE2_MAX_GRF);