nak: Allow SHF to use immediate encoding for shift

This is pretty common and avoid using a register for nothing in most
cases.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28819>
This commit is contained in:
Mary Guillemard 2024-04-18 19:56:04 +02:00 committed by Marge Bot
parent f008f6a33b
commit fe1aa98ab9
2 changed files with 7 additions and 2 deletions

View file

@ -3314,7 +3314,7 @@ pub struct OpShf {
#[src_type(ALU)]
pub high: Src,
#[src_type(GPR)]
#[src_type(ALU)]
pub shift: Src,
pub right: bool,

View file

@ -691,7 +691,12 @@ fn legalize_sm70_instr(
Op::PopC(_) => (),
Op::Shf(op) => {
copy_alu_src_if_not_reg(b, &mut op.low, SrcType::ALU);
copy_alu_src_if_not_reg(b, &mut op.high, SrcType::ALU);
copy_alu_src_if_both_not_reg(
b,
&op.shift,
&mut op.high,
SrcType::ALU,
);
}
Op::F2F(_) | Op::F2I(_) | Op::I2F(_) | Op::Mov(_) | Op::FRnd(_) => (),
Op::Prmt(op) => {