From 346262ceb6d5c6aab40b325e674a71de8860a062 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 2 Mar 2020 16:42:36 -0500 Subject: [PATCH] pan/bi: Structify FMA_FADD Just to make it easier to work with. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost.h | 27 +++++++++++++++++++++++++++ src/panfrost/bifrost/disassemble.c | 16 ++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 1b12aa9dad2..752b840a2d4 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -82,6 +82,33 @@ struct bifrost_add_inst { unsigned op : 17; }; +enum bifrost_outmod { + BIFROST_NONE = 0x0, + BIFROST_POS = 0x1, + BIFROST_SAT_SIGNED = 0x2, + BIFROST_SAT = 0x3, +}; + +enum bifrost_roundmode { + BIFROST_RTE = 0x0, + BIFROST_RTP = 0x1, + BIFROST_RTN = 0x2, + BIFROST_RTZ = 0x3 +}; + +struct bifrost_fma_add { + unsigned src0 : 3; + unsigned src1 : 3; + unsigned src1_abs : 1; + unsigned src0_neg : 1; + unsigned src1_neg : 1; + unsigned unk : 3; + unsigned src0_abs : 1; + enum bifrost_outmod outmod : 2; + enum bifrost_roundmode roundmode : 2; + unsigned op : 6; +}; + enum bifrost_csel_cond { BIFROST_FEQ_F = 0x0, BIFROST_FGT_F = 0x1, diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c index 48fcdce17e6..2d3db571d0e 100644 --- a/src/panfrost/bifrost/disassemble.c +++ b/src/panfrost/bifrost/disassemble.c @@ -483,15 +483,15 @@ static void dump_src(FILE *fp, unsigned src, struct bifrost_regs srcs, uint64_t static void dump_output_mod(FILE *fp, unsigned mod) { switch (mod) { - case 0: + case BIFROST_NONE: break; - case 1: + case BIFROST_POS: fprintf(fp, ".clamp_0_inf"); break; // max(out, 0) - case 2: + case BIFROST_SAT_SIGNED: fprintf(fp, ".clamp_m1_1"); break; // clamp(out, -1, 1) - case 3: + case BIFROST_SAT: fprintf(fp, ".clamp_0_1"); break; // clamp(out, 0, 1) default: @@ -540,18 +540,18 @@ static void dump_minmax_mode(FILE *fp, unsigned mod) static void dump_round_mode(FILE *fp, unsigned mod) { switch (mod) { - case 0: + case BIFROST_RTE: /* roundTiesToEven, the IEEE default. */ break; - case 1: + case BIFROST_RTP: /* roundTowardPositive in the IEEE spec. */ fprintf(fp, ".round_pos"); break; - case 2: + case BIFROST_RTN: /* roundTowardNegative in the IEEE spec. */ fprintf(fp, ".round_neg"); break; - case 3: + case BIFROST_RTZ: /* roundTowardZero in the IEEE spec. */ fprintf(fp, ".round_zero"); break; -- 2.30.2