nak: Add source and destination types for carry values

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30402>
This commit is contained in:
Faith Ekstrand
2024-07-26 23:19:32 -05:00
committed by Marge Bot
parent eb5f333606
commit f557423467
4 changed files with 20 additions and 1 deletions

View File

@@ -807,6 +807,14 @@ impl SrcRef {
}
}
pub fn is_carry(&self) -> bool {
match self {
SrcRef::SSA(ssa) => ssa.file() == Some(RegFile::Carry),
SrcRef::Reg(reg) => reg.file() == RegFile::Carry,
_ => false,
}
}
#[allow(dead_code)]
pub fn is_barrier(&self) -> bool {
match self {
@@ -1359,6 +1367,7 @@ impl Src {
self.src_ref.is_predicate()
}
SrcType::Carry => self.src_mod.is_none() && self.src_ref.is_carry(),
SrcType::Bar => self.src_mod.is_none() && self.src_ref.is_barrier(),
}
}
@@ -1402,6 +1411,7 @@ pub enum SrcType {
I32,
B32,
Pred,
Carry,
Bar,
}
@@ -1462,6 +1472,7 @@ pub enum DstType {
F16v2,
F32,
F64,
Carry,
Bar,
Vec,
}
@@ -3313,10 +3324,12 @@ impl DisplayOp for OpIAdd2 {
#[derive(SrcsAsSlice, DstsAsSlice)]
pub struct OpIAdd2X {
pub dst: Dst,
#[dst_type(Carry)]
pub carry_out: Dst,
#[src_type(B32)]
pub srcs: [Src; 2],
#[src_type(Carry)]
pub carry_in: Src,
}

View File

@@ -448,7 +448,7 @@ impl CopyPropPass {
SrcType::F64 => {
self.prop_to_f64_src(cbuf_rule, src);
}
SrcType::Bar => (),
SrcType::Carry | SrcType::Bar => (),
}
}

View File

@@ -373,6 +373,9 @@ fn legalize_ext_instr(op: &mut impl SrcsAsSlice, _b: &mut LegalizeBuilder) {
SrcType::Pred => {
panic!("Predicates must be legalized explicitly");
}
SrcType::Carry => {
panic!("Carry values must be legalized explicitly");
}
SrcType::Bar => panic!("Barrier regs are Volta+"),
}
}

View File

@@ -772,6 +772,9 @@ fn legalize_ext_instr(op: &mut impl SrcsAsSlice, b: &mut LegalizeBuilder) {
SrcType::Pred => {
panic!("Predicates must be legalized explicitly");
}
SrcType::Carry => {
panic!("Carry is invalid on Volta+");
}
SrcType::Bar => (),
}
}