From cb156a468ec05ec0f082b98b7692f01ea13ec479 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 5 May 2025 10:09:16 -0400 Subject: [PATCH] nak: Match on the SrcRef directly in Src::is_nonzero() Calling as_u32() isn't really doing us any good here since we want to fail for SrcRef::Zero anyway. Also assert that src_mod == None since we don't handle FNeg in this path. Part-of: --- src/nouveau/compiler/nak/ir.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index ae05ff6345f..ad524e98ba4 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -1304,7 +1304,8 @@ impl Src { } pub fn is_nonzero(&self) -> bool { - matches!(self.as_u32(), Some(x) if x != 0) + assert!(self.src_mod.is_none()); + matches!(self.src_ref, SrcRef::Imm32(x) if x != 0) } pub fn is_fneg_zero(&self, src_type: SrcType) -> bool {