From 1ff7135691d9fd3e0135ef5a13f6c95ad259094c Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Tue, 29 Apr 2025 01:13:36 -0400 Subject: [PATCH] nak: Remove hfma2 src 1 modifiers This fixes a compilation issue in Marvel Rivals where the legalization logic and the encoding logic don't line up, which results in an assertion failure on this instruction: r17 = hfma2 r17.xx -r18.xx 0x3c003c00 The fix here is a little overly restrictive because it turns out we actually do have modifiers for all 3 sources. Those modifiers will be added in later commits. Fixes: 567cae69c3ef ("nak: Add 16-bits float operations") Reviewed-by: Mary Guillemard Part-of: --- src/nouveau/compiler/nak/sm70_encode.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/sm70_encode.rs b/src/nouveau/compiler/nak/sm70_encode.rs index 7728b352525..768c9d30416 100644 --- a/src/nouveau/compiler/nak/sm70_encode.rs +++ b/src/nouveau/compiler/nak/sm70_encode.rs @@ -1113,14 +1113,16 @@ impl SM70Op for OpHFma2 { b.copy_alu_src_if_not_reg(src1, gpr, SrcType::F16v2); b.copy_alu_src_if_both_not_reg(src1, src2, gpr, SrcType::F16v2); - // HFMA2 doesn't have fabs or fneg on SRC2. + if !src1.src_mod.is_none() { + b.copy_alu_src_and_lower_fmod(src1, gpr, SrcType::F16v2); + } if !src2.src_mod.is_none() { b.copy_alu_src_and_lower_fmod(src2, gpr, SrcType::F16v2); } } fn encode(&self, e: &mut SM70Encoder<'_>) { - // HFMA2 doesn't have fneg and fabs on SRC2. + assert!(self.srcs[1].src_mod.is_none()); assert!(self.srcs[2].src_mod.is_none()); e.encode_fp16_alu(