nak: Make PRMT selection a Src

On SM50, because of immediate form limitations to 20 bits, we need to
use a register to use PRMT.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Mary Guillemard 2023-09-05 15:24:28 +02:00 committed by Marge Bot
parent c38c456270
commit 405a9ccca8
3 changed files with 25 additions and 29 deletions

View file

@ -837,7 +837,7 @@ impl SM75Instr {
0x16,
Some(op.dst),
ALUSrc::from_src(&op.srcs[0]),
ALUSrc::Imm32(op.selection.inner()),
ALUSrc::from_src(&op.selection),
ALUSrc::from_src(&op.srcs[1]),
);
}

View file

@ -699,27 +699,30 @@ impl<'a> ShaderFromNir<'a> {
});
let dst = b.alloc_ssa(RegFile::GPR, 1);
let selection = PrmtSelectionEval::from([
PrmtSelection {
src: PrmtSrc::Byte5,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte4,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte1,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte0,
sign_extend: false,
},
]);
b.push_op(OpPrmt {
dst: dst.into(),
srcs: [low.into(), high.into()],
selection: PrmtSelectionEval::from([
PrmtSelection {
src: PrmtSrc::Byte5,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte4,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte1,
sign_extend: false,
},
PrmtSelection {
src: PrmtSrc::Byte0,
sign_extend: false,
},
]),
selection: Src::new_imm_u32(selection.inner()),
});
dst
}

View file

@ -2584,22 +2584,15 @@ pub struct OpPrmt {
#[src_type(ALU)]
pub srcs: [Src; 2],
pub selection: PrmtSelectionEval,
pub selection: Src,
}
impl fmt::Display for OpPrmt {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let sel: [PrmtSelection; 4] = self.selection.into();
write!(
f,
"PRMT {}, {} [{:?}, {:?}, {:?}, {:?}], {}",
self.dst,
self.srcs[0],
sel[0].src,
sel[1].src,
sel[2].src,
sel[3].src,
self.srcs[1],
"PRMT {}, {} [{}], {}",
self.dst, self.srcs[0], self.selection, self.srcs[1],
)
}
}