diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index 2f9feda1aad..6daf4a2b54a 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -1315,6 +1315,16 @@ pub enum SrcType { impl SrcType { const DEFAULT: SrcType = SrcType::GPR; + + pub fn is_fp16(&self) -> bool { + matches!(self, Self::F16 | Self::F16v2) + } + + /// Checks if consuming a value has the same semantics in regards to ftz + /// and modifiers. E.g. F16v2 and F16 would return true here. + pub fn eq_ftz_mod(&self, other: Self) -> bool { + *self == other || (self.is_fp16() && other.is_fp16()) + } } pub type SrcTypeList = AttrList; diff --git a/src/nouveau/compiler/nak/opt_copy_prop.rs b/src/nouveau/compiler/nak/opt_copy_prop.rs index ec3932baa0f..e1e2e3594bd 100644 --- a/src/nouveau/compiler/nak/opt_copy_prop.rs +++ b/src/nouveau/compiler/nak/opt_copy_prop.rs @@ -301,7 +301,8 @@ impl<'a> CopyPropPass<'a> { } // If there are modifiers, the source types have to match - if !entry.src.is_unmodified() && entry.src_type != src_type + if !entry.src.is_unmodified() + && !entry.src_type.eq_ftz_mod(src_type) { return; }