pan/bi: Pack FMA SEL8
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 25 Apr 2020 00:48:59 +0000 (20:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 27 Apr 2020 14:52:26 +0000 (14:52 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4766>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bifrost.h

index 211c9e0fa1acbaa6321dc9d52e9c0035869c0f77..67912b6aaee22fa4c76c10080c5c034386a5b022 100644 (file)
@@ -930,6 +930,27 @@ bi_pack_fma_select(bi_instruction *ins, struct bi_registers *regs)
                 unsigned swiz = (ins->swizzle[0][0] | (ins->swizzle[1][0] << 1));
                 unsigned op = BIFROST_FMA_SEL_16(swiz);
                 return bi_pack_fma_2src(ins, regs, op);
+        } else if (size == 8) {
+                unsigned swiz = 0;
+
+                for (unsigned c = 0; c < 4; ++c) {
+                        if (ins->swizzle[c][0]) {
+                                /* Ensure lowering restriction is met */
+                                assert(ins->swizzle[c][0] == 2);
+                                swiz |= (1 << c);
+                        }
+                }
+
+                struct bifrost_fma_sel8 pack = {
+                        .src0 = bi_get_src(ins, regs, 0, true),
+                        .src1 = bi_get_src(ins, regs, 1, true),
+                        .src2 = bi_get_src(ins, regs, 2, true),
+                        .src3 = bi_get_src(ins, regs, 3, true),
+                        .swizzle = swiz,
+                        .op = BIFROST_FMA_OP_SEL8
+                };
+
+                RETURN_PACKED(pack);
         } else {
                 unreachable("Unimplemented");
         }
index a7789a5a7fafd59048d6779c1dfae0b73e801d11..4262e0e90d46547c7119568b18112ac1e2fc8207 100644 (file)
@@ -112,6 +112,17 @@ struct bifrost_fma_2src {
         unsigned op   : 17;
 } __attribute__((packed));
 
+#define BIFROST_FMA_OP_SEL8 (0x71)
+
+struct bifrost_fma_sel8 {
+        unsigned src0 : 3;
+        unsigned src1 : 3;
+        unsigned src2 : 3;
+        unsigned src3 : 3;
+        unsigned swizzle : 4;
+        unsigned op   : 7;
+} __attribute__((packed));
+
 #define BIFROST_FMA_OP_MSCALE (0x50 >> 3)
 
 struct bifrost_fma_mscale {