pan/bi: Use canonical floating-point modes
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 2 Oct 2020 17:23:33 +0000 (13:23 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 10 Oct 2020 20:53:09 +0000 (16:53 -0400)
First few pre-clause modifiers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>

src/panfrost/bifrost/bifrost.h
src/panfrost/bifrost/disassemble.c

index 177cb03..ca34ab7 100644 (file)
@@ -47,14 +47,37 @@ enum bifrost_clause_type {
         BIFROST_CLAUSE_64BIT      = 15
 };
 
+enum bifrost_ftz {
+        BIFROST_FTZ_DISABLE = 0,
+        BIFROST_FTZ_DX11 = 1,
+        BIFROST_FTZ_ALWAYS = 2,
+        BIFROST_FTZ_ABRUPT = 3
+};
+
+enum bifrost_exceptions {
+        BIFROST_EXCEPTIONS_ENABLED = 0,
+        BIFROST_EXCEPTIONS_DISABLED = 1,
+        BIFROST_EXCEPTIONS_PRECISE_DIVISION = 2,
+        BIFROST_EXCEPTIONS_PRECISE_SQRT = 3,
+};
+
 struct bifrost_header {
-        unsigned unk0 : 7;
-        // If true, convert any infinite result of any floating-point operation to
-        // the biggest representable number.
+        /* Reserved */
+        unsigned zero1 : 5;
+
+        /* Flush-to-zero mode, leave zero for GL */
+        enum bifrost_ftz flush_to_zero : 2;
+
+        /* Convert any infinite result of any floating-point operation to the
+         * biggest representable number */
         unsigned suppress_inf: 1;
-        // Convert any NaN results to 0.
+
+        /* Convert NaN to +0.0 */
         unsigned suppress_nan : 1;
-        unsigned unk1 : 2;
+
+        /* Floating-point excception handling mode */
+        enum bifrost_exceptions float_exceptions : 2;
+
         // true if the execution mask of the next clause is the same as the mask of
         // the current clause.
         unsigned back_to_back : 1;
index 30361fd..fe1b116 100644 (file)
@@ -119,14 +119,26 @@ static void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
                 fprintf(fp, "we ");
 
         if (header.suppress_inf)
-                fprintf(fp, "suppress-inf ");
+                fprintf(fp, "inf_suppress ");
         if (header.suppress_nan)
-                fprintf(fp, "suppress-nan ");
+                fprintf(fp, "nan_suppress ");
+
+        if (header.flush_to_zero == BIFROST_FTZ_DX11)
+                fprintf(fp, "ftz_dx11 ");
+        else if (header.flush_to_zero == BIFROST_FTZ_ALWAYS)
+                fprintf(fp, "ftz_hsa ");
+        if (header.flush_to_zero == BIFROST_FTZ_ABRUPT)
+                fprintf(fp, "ftz_au ");
+
+        assert(!header.zero1);
+
+        if (header.float_exceptions == BIFROST_EXCEPTIONS_DISABLED)
+                fprintf(fp, "fpe_ts ");
+        else if (header.float_exceptions == BIFROST_EXCEPTIONS_PRECISE_DIVISION)
+                fprintf(fp, "fpe_pd ");
+        else if (header.float_exceptions == BIFROST_EXCEPTIONS_PRECISE_SQRT)
+                fprintf(fp, "fpe_psqr ");
 
-        if (header.unk0)
-                fprintf(fp, "unk0 ");
-        if (header.unk1)
-                fprintf(fp, "unk1 ");
         if  (header.unk2)
                 fprintf(fp, "unk2 ");
         if (header.unk3)