From 4b5eec6c2a80d18994724046cf365b43b08cb520 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 5 May 2025 10:10:18 -0400 Subject: [PATCH] nak/sm20: Use SrcRef::as_u32() This makes more sense as we don't want any complex logic around source modifiers or any of that. We just want to handle Zero and Imm32 in the same case. Also, explicitly assert that modifiers are None, which is more clear anyway. Part-of: --- src/nouveau/compiler/nak/sm20.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/sm20.rs b/src/nouveau/compiler/nak/sm20.rs index 89c1082ac1e..74dde75f02a 100644 --- a/src/nouveau/compiler/nak/sm20.rs +++ b/src/nouveau/compiler/nak/sm20.rs @@ -1639,7 +1639,8 @@ impl SM20Op for OpShfl { e.set_dst(14..20, self.dst); e.set_reg_src(20..26, self.src); - if let Some(u) = self.lane.as_u32() { + assert!(self.lane.src_mod.is_none()); + if let Some(u) = self.lane.src_ref.as_u32() { e.set_field(26..32, u & 0x1f); e.set_bit(5, true); } else { @@ -1647,7 +1648,8 @@ impl SM20Op for OpShfl { e.set_bit(5, false); } - if let Some(u) = self.c.as_u32() { + assert!(self.c.src_mod.is_none()); + if let Some(u) = self.c.src_ref.as_u32() { e.set_field(42..55, u & 0x1fff); e.set_bit(6, true); } else {