mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 23:08:18 +02:00
kraid: Support signless IAdd
Signed and unsigned types are only allowed for IADD and not IADD_IMM so it's simpler if we support signless for regular IADD. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41841>
This commit is contained in:
parent
1ad7ddf076
commit
cd679dbc5d
4 changed files with 12 additions and 4 deletions
|
|
@ -108,6 +108,14 @@ impl DataType {
|
|||
DataType::from_pieces(1, num_type, bits)
|
||||
}
|
||||
|
||||
pub const fn i_as_u(self) -> DataType {
|
||||
let (comps, mut num_type, bits) = self.to_pieces();
|
||||
if matches!(num_type, Some(NumericType::Integer)) {
|
||||
num_type = Some(NumericType::UnsignedInteger);
|
||||
}
|
||||
DataType::from_pieces(comps, num_type, bits)
|
||||
}
|
||||
|
||||
pub fn bits(&self) -> Option<NonZeroU8> {
|
||||
NonZeroU8::new(self.to_pieces().2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ impl V9Instr for OpIAdd {
|
|||
if let SrcRef::Imm32(_) = &self.srcs[1].src_ref {
|
||||
IaddImm::get_info(self.dst_type.try_into().ok()?, arch)
|
||||
} else {
|
||||
Iadd::get_info(self.dst_type.try_into().ok()?, arch)
|
||||
Iadd::get_info(self.dst_type.i_as_u().try_into().ok()?, arch)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ impl V9Instr for OpIAdd {
|
|||
})
|
||||
} else {
|
||||
e.encode(Iadd {
|
||||
variant: self.dst_type.try_into().unwrap(),
|
||||
variant: self.dst_type.i_as_u().try_into().unwrap(),
|
||||
dst: op_encode_dst(self, &self.dst),
|
||||
src0: op_encode_src(self, &self.srcs[0]),
|
||||
src1: op_encode_src(self, &self.srcs[1]),
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ impl<'a> ShaderFromNir<'a> {
|
|||
nir_op_iadd => {
|
||||
b.push_op(OpIAdd {
|
||||
dst: dst.into(),
|
||||
dst_type: dst_type(NumericType::UnsignedInteger),
|
||||
dst_type: dst_type(NumericType::Integer),
|
||||
saturate: false,
|
||||
srcs: [srcs(0), srcs(1)],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ impl fmt::Display for OpFCmp {
|
|||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Opcode)]
|
||||
#[variants(dst_type in [S16, U16, V2S16, V2U16, S32, U32])]
|
||||
#[variants(dst_type in [I16, S16, U16, V2I16, V2S16, V2U16, I32, S32, U32])]
|
||||
pub struct OpIAdd {
|
||||
pub dst: Dst,
|
||||
pub dst_type: DataType,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue