nak: remove conversion into the same type

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
Eric Engestrom 2025-10-04 16:16:36 +02:00
parent f7a31b7d48
commit 10396d8db6
5 changed files with 16 additions and 19 deletions

View file

@ -846,12 +846,9 @@ fn instr_assign_regs_file(
}
let align = vec_dst.comps.next_power_of_two();
if let Some(reg) = ra.try_find_unused_reg_range(
next_dst_reg,
vec_dst.comps.try_into().unwrap(),
align,
0,
) {
if let Some(reg) =
ra.try_find_unused_reg_range(next_dst_reg, vec_dst.comps, align, 0)
{
vec_dst.reg = reg;
next_dst_reg = reg + u32::from(vec_dst.comps);
} else {

View file

@ -728,7 +728,7 @@ pub trait SSABuilder: Builder {
op: RroOp::SinCos,
src,
});
tmp.into()
tmp
};
self.mufu(MuFuOp::Sin, tmp.into())
}
@ -744,7 +744,7 @@ pub trait SSABuilder: Builder {
op: RroOp::SinCos,
src,
});
tmp.into()
tmp
};
self.mufu(MuFuOp::Cos, tmp.into())
}
@ -861,7 +861,7 @@ pub trait SSABuilder: Builder {
self.alloc_ssa(RegFile::GPR)
};
self.copy_to(dst.into(), src);
dst.into()
dst
}
fn bmov_to_bar(&mut self, src: Src) -> SSAValue {

View file

@ -1368,7 +1368,7 @@ impl<'a> ShaderFromNir<'a> {
let src = srcs(0).to_ssa();
if src_bits == 64 {
if dst_bits == 64 {
src.into()
src
} else {
b.prmt(src[0].into(), src[1].into(), prmt_lo).into()
}
@ -3822,7 +3822,7 @@ impl<'a> ShaderFromNir<'a> {
dst_type: dst_type,
src_type: FloatType::F16,
mat_size: mat_size,
srcs: [cmat_a.into(), cmat_b.into(), cmat_c.into()],
srcs: [cmat_a, cmat_b, cmat_c],
});
}
NAK_CMAT_TYPE_M8N8K16_INT
@ -3849,7 +3849,7 @@ impl<'a> ShaderFromNir<'a> {
b.push_op(OpImma {
dst: dst.clone().into(),
mat_size,
srcs: [cmat_a.into(), cmat_b.into(), cmat_c.into()],
srcs: [cmat_a, cmat_b, cmat_c],
src_types: [a_type, b_type],
saturate: flags.sat(),
});
@ -3857,7 +3857,7 @@ impl<'a> ShaderFromNir<'a> {
val => unreachable!("Unknown cmat_type {val}"),
}
self.set_dst(&intrin.def, dst.into());
self.set_dst(&intrin.def, dst);
}
_ => panic!(
"Unsupported intrinsic instruction: {}",

View file

@ -404,7 +404,7 @@ pub fn test_foldable_op_with(
for ssa in &vec[..] {
let u = match ssa.file() {
RegFile::Pred => b.sel((*ssa).into(), 1.into(), 0.into()),
RegFile::GPR => (*ssa).into(),
RegFile::GPR => *ssa,
RegFile::Carry => {
let gpr = b.alloc_ssa(RegFile::GPR);
b.push_op(OpIAdd2X {
@ -413,7 +413,7 @@ pub fn test_foldable_op_with(
srcs: [0.into(), 0.into()],
carry_in: (*ssa).into(),
});
gpr.into()
gpr
}
file => panic!("Can't auto-test {file:?} data"),
};
@ -1666,7 +1666,7 @@ fn test_op_ldsm() {
b.push_op(OpSt {
addr: offset.into(),
data: input.into(),
offset: 0.into(),
offset: 0,
access: MemAccess {
mem_type: MemType::B128,
space: MemSpace::Shared,
@ -1685,9 +1685,9 @@ fn test_op_ldsm() {
mat_size: LdsmSize::M8N8,
mat_count: 4,
addr: addr.into(),
offset: 0.into(),
offset: 0,
});
b.st_test_data(16, MemType::B128, res.into());
b.st_test_data(16, MemType::B128, res);
type Data = [u16; 4 * 2 * 2];
b.set_shared_size((size_of::<Data>() * 32 / 2) as u16);

View file

@ -642,7 +642,7 @@ fn fill_qmd<Q: QMD>(
qmd.set_slm_size(info.slm_size);
assert!(qmd_info.smem_size <= u32::from(dev.max_smem_per_wg_kB) * 1024);
qmd.set_smem_size(qmd_info.smem_size.into(), dev, info);
qmd.set_smem_size(qmd_info.smem_size, dev, info);
for i in 0..qmd_info.num_cbufs {
let cb = &qmd_info.cbufs[usize::try_from(i).unwrap()];