From a5975883b94dc0d8f8ca0d82ffd11e5788ce624e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 2 Oct 2020 13:23:33 -0400 Subject: [PATCH] pan/bi: Use canonical floating-point modes First few pre-clause modifiers. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bifrost.h | 33 +++++++++++++++++++++++++----- src/panfrost/bifrost/disassemble.c | 24 ++++++++++++++++------ 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 177cb039609..ca34ab763c3 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -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; diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c index 30361fd735a..fe1b116e93c 100644 --- a/src/panfrost/bifrost/disassemble.c +++ b/src/panfrost/bifrost/disassemble.c @@ -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)