diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index 77370a9be20..f40483aabd0 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -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, } diff --git a/src/nouveau/compiler/nak/opt_copy_prop.rs b/src/nouveau/compiler/nak/opt_copy_prop.rs index a17c46222a1..657f14c9844 100644 --- a/src/nouveau/compiler/nak/opt_copy_prop.rs +++ b/src/nouveau/compiler/nak/opt_copy_prop.rs @@ -448,7 +448,7 @@ impl CopyPropPass { SrcType::F64 => { self.prop_to_f64_src(cbuf_rule, src); } - SrcType::Bar => (), + SrcType::Carry | SrcType::Bar => (), } } diff --git a/src/nouveau/compiler/nak/sm50.rs b/src/nouveau/compiler/nak/sm50.rs index d1a8a86c9ab..ae476fa6de5 100644 --- a/src/nouveau/compiler/nak/sm50.rs +++ b/src/nouveau/compiler/nak/sm50.rs @@ -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+"), } } diff --git a/src/nouveau/compiler/nak/sm70.rs b/src/nouveau/compiler/nak/sm70.rs index 47519391aa8..fb13e405886 100644 --- a/src/nouveau/compiler/nak/sm70.rs +++ b/src/nouveau/compiler/nak/sm70.rs @@ -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 => (), } }