mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-10 01:18:18 +02:00
kraid: Implement nir_op_iadd
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
This commit is contained in:
parent
b2adfd28e9
commit
00e2afdbb9
2 changed files with 30 additions and 0 deletions
|
|
@ -349,6 +349,14 @@ impl<'a> ShaderFromNir<'a> {
|
|||
accum_op: CmpAccumOp::None,
|
||||
});
|
||||
}
|
||||
nir_op_iadd => {
|
||||
b.push_op(OpIAdd {
|
||||
dst: dst.into(),
|
||||
dst_type: dst_type(NumericType::UnsignedInteger),
|
||||
saturate: false,
|
||||
srcs: [srcs(0), srcs(1)],
|
||||
});
|
||||
}
|
||||
_ => panic!("Unsupported ALU instruction: {}", alu.info().name()),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,27 @@ impl fmt::Display for OpFCmp {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Opcode)]
|
||||
#[variants(dst_type in [S16, U16, V2S16, V2U16, S32, U32])]
|
||||
pub struct OpIAdd {
|
||||
pub dst: Dst,
|
||||
pub dst_type: DataType,
|
||||
pub saturate: bool,
|
||||
pub srcs: [Src; 2],
|
||||
}
|
||||
|
||||
impl fmt::Display for OpIAdd {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let sat = if self.saturate { ".sat" } else { "" };
|
||||
write!(
|
||||
f,
|
||||
"{} = IADD.{}{sat} {} {}",
|
||||
&self.dst, self.dst_type, &self.srcs[0], &self.srcs[1],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Opcode)]
|
||||
pub struct OpMkVecV2I8 {
|
||||
|
|
@ -244,6 +265,7 @@ pub enum Op {
|
|||
End(OpEnd),
|
||||
FAdd(OpFAdd),
|
||||
FCmp(OpFCmp),
|
||||
IAdd(OpIAdd),
|
||||
MkVecV2I8(OpMkVecV2I8),
|
||||
MkVecV4I8(OpMkVecV4I8),
|
||||
Mov(OpMov),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue