pan/bi: Add one-source f32->f16 op
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 28 Mar 2020 00:08:03 +0000 (20:08 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 31 Mar 2020 01:12:26 +0000 (01:12 +0000)
This really has a second op for vectorization but we don't handle this
quite yet...

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

src/panfrost/bifrost/bi_pack.c

index cac1ef5f31f9c8ee91a840e9b36f2bb32ec4e2b5..c53b40fe2b4e60673d3be32c64189cc810e88fad 100644 (file)
@@ -642,7 +642,14 @@ bi_pack_fma_convert(bi_instruction *ins, struct bi_registers *regs)
                 }
         } else if (from_size == 32 && to_size == 16) {
                 if (from_base == nir_type_float) {
-                        /* float32_to_float16 */
+                        /* TODO: second vectorized source? */
+                        struct bifrost_fma_2src pack = {
+                                .src0 = bi_get_src(ins, regs, 0, true),
+                                .src1 = BIFROST_SRC_STAGE, /* 0 */
+                                .op = BIFROST_FMA_FLOAT32_TO_16
+                        };
+
+                        RETURN_PACKED(pack);
                 } else {
                         /* XXX: No int32_to_int16? */
                 }