pan/bi: Structify FMA_FADD
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 2 Mar 2020 21:42:36 +0000 (16:42 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 3 Mar 2020 00:03:50 +0000 (00:03 +0000)
Just to make it easier to work with.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4025>

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

index 1b12aa9..752b840 100644 (file)
@@ -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,
index 48fcdce..2d3db57 100644 (file)
@@ -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;