From: Alyssa Rosenzweig Date: Sat, 25 Apr 2020 00:48:59 +0000 (-0400) Subject: pan/bi: Pack FMA SEL8 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d31e4879f0b0034f817e60acdd05574ed610e56b;p=mesa.git pan/bi: Pack FMA SEL8 Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 211c9e0fa1a..67912b6aaee 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -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"); } diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index a7789a5a7fa..4262e0e90d4 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -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 {