mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-21 01:38:23 +02:00
kraid/nir: Emit OpCopy instead of OpMov
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42200>
This commit is contained in:
parent
0fd2f01640
commit
f9e1e3cbd3
3 changed files with 9 additions and 9 deletions
|
|
@ -20,9 +20,9 @@ pub trait Builder {
|
|||
pub trait SSABuilder: Builder {
|
||||
fn alloc_ssa(&mut self, bits: u8) -> SSAValue;
|
||||
|
||||
fn mov_i16(&mut self, src: Src) -> SSAValue {
|
||||
fn copy_i16(&mut self, src: Src) -> SSAValue {
|
||||
let def = self.alloc_ssa(16);
|
||||
self.push_op(OpMov {
|
||||
self.push_op(OpCopy {
|
||||
dst: def.into(),
|
||||
dst_type: DataType::I16,
|
||||
src,
|
||||
|
|
@ -30,9 +30,9 @@ pub trait SSABuilder: Builder {
|
|||
def
|
||||
}
|
||||
|
||||
fn mov_i32(&mut self, src: Src) -> SSAValue {
|
||||
fn copy_i32(&mut self, src: Src) -> SSAValue {
|
||||
let def = self.alloc_ssa(32);
|
||||
self.push_op(OpMov {
|
||||
self.push_op(OpCopy {
|
||||
dst: def.into(),
|
||||
dst_type: DataType::I32,
|
||||
src,
|
||||
|
|
|
|||
|
|
@ -178,12 +178,12 @@ impl<'a> ShaderFromNir<'a> {
|
|||
assert_eq!(imm_u32.len(), usize::from(bits.div_ceil(32)));
|
||||
|
||||
if bits <= 16 {
|
||||
let ssa = b.mov_i16(Src::imm_u16(imm_u32[0] as u16));
|
||||
let ssa = b.copy_i16(Src::imm_u16(imm_u32[0] as u16));
|
||||
self.set_ssa(&load.def, vec![ssa]);
|
||||
} else {
|
||||
self.set_ssa(
|
||||
&load.def,
|
||||
imm_u32.into_iter().map(|u| b.mov_i32(u.into())).collect(),
|
||||
imm_u32.into_iter().map(|u| b.copy_i32(u.into())).collect(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let mut dst_vec = Vec::new();
|
||||
if srcs.len() == 1 && src_bit_size <= 16 {
|
||||
let x = srcs.next().unwrap();
|
||||
dst_vec.push(b.mov_i16(x));
|
||||
dst_vec.push(b.copy_i16(x));
|
||||
} else if srcs.len() == 2 && src_bit_size == 8 {
|
||||
let x = srcs.next().unwrap();
|
||||
let y = srcs.next().unwrap();
|
||||
|
|
@ -286,7 +286,7 @@ impl<'a> ShaderFromNir<'a> {
|
|||
dst_vec.push(b.mkvec_v2i16(x, y));
|
||||
}
|
||||
} else if src_bit_size == 32 {
|
||||
dst_vec = srcs.map(|src| b.mov_i32(src)).collect();
|
||||
dst_vec = srcs.map(|src| b.copy_i32(src)).collect();
|
||||
} else {
|
||||
panic!("Unsupported bit size: {src_bit_size}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ impl VirtualOpcode for OpMkVecV4I8 {
|
|||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Opcode)]
|
||||
#[variants(dst_type in [I16, V2I16, I32])]
|
||||
#[variants(dst_type in [V2I16, I32])]
|
||||
pub struct OpMov {
|
||||
pub dst: Dst,
|
||||
pub dst_type: DataType,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue