nak: Fix encoding of dsetp with RZ on SM70+

The `as_reg().is_some()` check returns false when src[1].src_ref is
Zero but we want to handle that as a register case.  Replace it with a
match instead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
This commit is contained in:
Faith Ekstrand 2023-12-18 18:13:56 -06:00 committed by Marge Bot
parent 52dbf44d2e
commit d03cbac05a

View file

@ -613,22 +613,25 @@ impl SM70Instr {
}
fn encode_dsetp(&mut self, op: &OpDSetP) {
if op.srcs[1].src_ref.as_reg().is_some() {
self.encode_alu(
0x02a,
None,
ALUSrc::from_src(&op.srcs[0]),
ALUSrc::from_src(&op.srcs[1]),
ALUSrc::None,
);
} else {
self.encode_alu(
0x02a,
None,
ALUSrc::from_src(&op.srcs[0]),
ALUSrc::None,
ALUSrc::from_src(&op.srcs[1]),
);
match op.srcs[1].src_ref {
SrcRef::Reg(_) | SrcRef::Zero => {
self.encode_alu(
0x02a,
None,
ALUSrc::from_src(&op.srcs[0]),
ALUSrc::from_src(&op.srcs[1]),
ALUSrc::None,
);
}
_ => {
self.encode_alu(
0x02a,
None,
ALUSrc::from_src(&op.srcs[0]),
ALUSrc::None,
ALUSrc::from_src(&op.srcs[1]),
);
}
}
self.set_pred_set_op(74..76, op.set_op);