Module: Mesa
Branch: main
Commit: 97a59ded4399f8bc180fbf3ec75eaf51e0db3415
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97a59ded4399f8bc180fbf3ec75eaf51e0db3415

Author: Faith Ekstrand <[email protected]>
Date:   Thu Dec  7 11:05:50 2023 -0600

nak: Plumb through float controls for frnd[p]

Fixes: 1c84c8183c5b ("nak: Plumb through float controls")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26572>

---

 src/nouveau/compiler/nak/encode_sm70.rs | 2 +-
 src/nouveau/compiler/nak/from_nir.rs    | 1 +
 src/nouveau/compiler/nak/ir.rs          | 4 +++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/nouveau/compiler/nak/encode_sm70.rs 
b/src/nouveau/compiler/nak/encode_sm70.rs
index 6b335a3c0fa..981f12ae94b 100644
--- a/src/nouveau/compiler/nak/encode_sm70.rs
+++ b/src/nouveau/compiler/nak/encode_sm70.rs
@@ -928,7 +928,7 @@ impl SM70Instr {
         }
 
         self.set_field(84..86, (op.src_type.bits() / 8).ilog2());
-        self.set_bit(80, false); // TODO: FMZ
+        self.set_bit(80, op.ftz);
         self.set_rnd_mode(78..80, op.rnd_mode);
         self.set_field(75..77, (op.dst_type.bits() / 8).ilog2());
     }
diff --git a/src/nouveau/compiler/nak/from_nir.rs 
b/src/nouveau/compiler/nak/from_nir.rs
index 8b2e6816e12..bf760003bfa 100644
--- a/src/nouveau/compiler/nak/from_nir.rs
+++ b/src/nouveau/compiler/nak/from_nir.rs
@@ -671,6 +671,7 @@ impl<'a> ShaderFromNir<'a> {
                     src_type: ty,
                     dst_type: ty,
                     rnd_mode,
+                    ftz: self.float_ctl[ty].ftz,
                 });
                 dst
             }
diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs
index 1abf4de9b57..4e771977525 100644
--- a/src/nouveau/compiler/nak/ir.rs
+++ b/src/nouveau/compiler/nak/ir.rs
@@ -3077,6 +3077,7 @@ pub struct OpFRnd {
     pub dst_type: FloatType,
     pub src_type: FloatType,
     pub rnd_mode: FRndMode,
+    pub ftz: bool,
 }
 
 impl SrcsAsSlice for OpFRnd {
@@ -3100,9 +3101,10 @@ impl SrcsAsSlice for OpFRnd {
 
 impl DisplayOp for OpFRnd {
     fn fmt_op(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let ftz = if self.ftz { ".ftz" } else { "" };
         write!(
             f,
-            "frnd{}{}{} {}",
+            "frnd{}{}{}{ftz} {}",
             self.dst_type, self.src_type, self.rnd_mode, self.src,
         )
     }

Reply via email to