nak/legalize: Uniform instructions can't have cbuf sources

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
This commit is contained in:
Faith Ekstrand 2024-06-06 17:57:51 -05:00 committed by Marge Bot
parent 7efc113bfe
commit 66a5608c11

View file

@ -177,6 +177,17 @@ fn copy_alu_src(
src.src_ref = val.into();
}
fn copy_alu_src_if_cbuf(
b: &mut impl SSABuilder,
src: &mut Src,
reg_file: RegFile,
src_type: SrcType,
) {
if matches!(src.src_ref, SrcRef::CBuf(_)) {
copy_alu_src(b, src, reg_file, src_type);
}
}
fn copy_alu_src_if_not_reg(
b: &mut impl SSABuilder,
src: &mut Src,
@ -589,6 +600,14 @@ fn legalize_sm70_instr(
RegFile::GPR
};
if !matches!(&instr.op, Op::Ldc(_) | Op::Copy(_)) && instr.is_uniform() {
// Uniform instructions can't support cbufs
let src_types = instr.src_types();
for (i, src) in instr.srcs_mut().iter_mut().enumerate() {
copy_alu_src_if_cbuf(b, src, gpr, src_types[i]);
}
}
match &mut instr.op {
Op::FAdd(op) => {
let [ref mut src0, ref mut src1] = op.srcs;