pan/bi: Pack fma.fcmp16
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 28 Apr 2020 16:39:47 +0000 (12:39 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 17:17:48 +0000 (17:17 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4789>

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

index 8395b9821a738ff596a9ef2eec7aab531c61e7f2..28625ade980e0fab1f8d221c43f643baea38eeef 100644 (file)
@@ -1038,6 +1038,26 @@ bi_pack_fma_cmp(bi_instruction *ins, struct bi_registers *regs)
                         .op = BIFROST_FMA_OP_FCMP_GL
                 };
 
+                RETURN_PACKED(pack);
+        } else if (Tl == nir_type_float16 && Tr == nir_type_float16) {
+                bool flip = false;
+                bool l = bi_pack_fp16_abs(ins, regs, &flip);
+                enum bifrost_fcmp_cond cond = bi_fcmp_cond(ins->cond);
+
+                if (flip)
+                        cond = bi_flip_fcmp(cond);
+
+                struct bifrost_fma_fcmp16 pack = {
+                        .src0 = bi_get_src(ins, regs, flip ? 1 : 0, true),
+                        .src1 = bi_get_src(ins, regs, flip ? 0 : 1, true),
+                        .src0_swizzle = bi_swiz16(ins, flip ? 1 : 0),
+                        .src1_swizzle = bi_swiz16(ins, flip ? 0 : 1),
+                        .abs1 = l,
+                        .unk = 0,
+                        .cond = cond,
+                        .op = BIFROST_FMA_OP_FCMP_GL_16,
+                };
+
                 RETURN_PACKED(pack);
         } else {
                 unreachable("Unknown cmp type");
index 66e337ca99616e746e515715363261ddc8da7e92..bef8cd84f0023c44f7c560067efba289a46b335a 100644 (file)
@@ -422,6 +422,9 @@ struct bifrost_add_fcmp {
         unsigned op   : 6;
 } __attribute__((packed));
 
+#define BIFROST_FMA_OP_FCMP_GL_16 (0xc8000 >> 13)
+#define BIFROST_FMA_OP_FCMP_D3D_16 (0xcc000 >> 13)
+
 struct bifrost_fma_fcmp16 {
         unsigned src0 : 3;
         unsigned src1 : 3;