From f5f89407f6406baaaeccb1c319bf7a5fdc0a7215 Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Fri, 25 Apr 2025 13:34:45 -0400 Subject: [PATCH] nak: Handle CS2R latencies in SSA form Reviewed-by: Mary Guillemard Part-of: --- src/nouveau/compiler/nak/ir.rs | 8 ++++++++ src/nouveau/compiler/nak/sm75_instr_latencies.rs | 2 +- src/nouveau/compiler/nak/sm80_instr_latencies.rs | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index d949e280716..c15e52ad733 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -497,6 +497,14 @@ impl Dst { } .iter_mut() } + + pub fn comps(&self) -> u8 { + match self { + Dst::None => 0, + Dst::SSA(ssa) => ssa.comps(), + Dst::Reg(reg) => reg.comps(), + } + } } impl From for Dst { diff --git a/src/nouveau/compiler/nak/sm75_instr_latencies.rs b/src/nouveau/compiler/nak/sm75_instr_latencies.rs index f9f308ddb19..fd820dcf511 100644 --- a/src/nouveau/compiler/nak/sm75_instr_latencies.rs +++ b/src/nouveau/compiler/nak/sm75_instr_latencies.rs @@ -141,7 +141,7 @@ impl RegLatencySM75 { } } Op::CS2R(cs2r) => { - if cs2r.dst.as_reg().unwrap().comps() == 2 { + if cs2r.dst.comps() == 2 { CoupledDisp64 } else { CoupledAlu diff --git a/src/nouveau/compiler/nak/sm80_instr_latencies.rs b/src/nouveau/compiler/nak/sm80_instr_latencies.rs index 6fc87b06e20..1cb8de4c08d 100644 --- a/src/nouveau/compiler/nak/sm80_instr_latencies.rs +++ b/src/nouveau/compiler/nak/sm80_instr_latencies.rs @@ -186,7 +186,7 @@ impl RegLatencySM80 { } } Op::CS2R(cs2r) => { - if cs2r.dst.as_reg().unwrap().comps() == 2 { + if cs2r.dst.comps() == 2 { CoupledDisp64 } else { CoupledAlu